Class: Trellinator

TrellinatorCore.Trellinator()

The Trellinator object is a special instance of Member, which gets it's username from the token in the Configuration tab of the Trellinator spreadsheet. As such, this is a Member object that is always the Trello member on behalf of which Trellinator will act when making Trello API calls

This is particularly useful when you need to avoid taking action on notifications which have been caused by actions taken by Trellinator, and it is the Trellinator class that is used by the Member.notTrellinator method.

Another common use case is to find another board other than the one in which the notification occurred.

Trellinator also has a useful now() method which can be used so that, when you are creating your Murphy tests, you will be able to inject a "fake" time to act as the current date/time so you can get consistent output when testing.

The Trellinator object is also where a bunch of Date convenience functions are added to the Date prototype, and those functions are documented here

Methods that are added to the Date prototype in this class show up as "static" and belonging to Date#functionName, but they're not static. If you know how to make these not show as static, please send a pull request :)

Constructor

new Trellinator()

Source:
Examples
if(new Notification(posted).member().notTrellinator())
new Trellinator().board("Board Name").card("Ohai")
new Trellinator().name()

Methods

(static) Date#addDays(days)

Add X days to the date

Parameters:
Name Type Description
days int

number of days to add

Source:
Example
//Tomorrow
Trellinator.now().addDays(1);

(static) Date#addHours(hours)

Add X hours to the date

Parameters:
Name Type Description
hours int

number of hours to add

Source:
Example
Trellinator.now().addHours(1);

(static) Date#addMinutes(minutes)

Add X minutes to the date

Parameters:
Name Type Description
minutes int

number of minutes to add

Source:
Example
Trellinator.now().addMinutes(20);

(static) Date#addMonths(months)

Add X months to the date

Parameters:
Name Type Description
months int

number of months to add

Source:
Example
Trellinator.now().addMonths(1);

(static) Date#addWeekDays(days)

Add X weekdays to the date

Parameters:
Name Type Description
days int

number of days to add

Source:
Example
//Tomorrow
Trellinator.now().addWeekDays(1);

(static) Date#addWeeks(weeks)

Add X weeks to the date

Parameters:
Name Type Description
weeks int

number of weeks to add

Source:
Example
Trellinator.now().addWeeks(1);

(static) Date#at(time)

Set the time component of this date to the given time in 24 format, HH:MM seconds are not supportd

Parameters:
Name Type Description
time string

format HH:MM in 24 hour time

Source:
Example
//9am tomorrow
Trellinator.now().addDays(1).at("9:00");

(static) Date#butlerDefaultDate()

Return the current date in the format MONTH DAY, YEAR where MONTH is the full month such as August or September, day is the date without leading zeroes such as 1 or 19 and YEAR is the current year with 4 digits such as 2018. This method is created to return the date in the same format that Butler for Trello stores in the {date} variable

Source:
Example
Trellinator.now().butlerDefaultDate();

(static) Date#dayName()

Find out the name of the day, returned as the full day name eg. Monday

Source:
Example
Trellinator.now().dayName();

(static) Date#isWeekDay()

Returns true if this is monday - friday

Source:
Example
if(Trellinator.now().isWeekDay())

(static) Date#lastDayOfMonth()

Find the last day of the current month

Source:
Example
Trellinator.now().lastDayOfMonth();

(static) Date#minusDays(days)

Subtract X days from the current date

Parameters:
Name Type Description
days int

number of days to subtract

Source:
Example
//3 days ago
Trellinator.now().minusDays(3);

(static) Date#minusHours(hours)

Minus X hours from the date

Parameters:
Name Type Description
hours int

number of hours to minus

Source:
Example
Trellinator.now().minusHours(1);

(static) Date#minusMinutes(minutes)

Minus X minutes from the date

Parameters:
Name Type Description
minutes int

number of minutes to minus

Source:
Example
Trellinator.now().minusMinutes(20);

(static) Date#minusMonths(months)

Subtract X months from the date

Parameters:
Name Type Description
months int

number of months to subtract

Source:
Example
Trellinator.now().minusMonths(1);

(static) Date#minusWeekDays(days)

Subtract X weekdays from the current date

Parameters:
Name Type Description
days int

number of days to subtract

Source:
Example
//3 days ago
Trellinator.now().minusWeekDays(3);

(static) Date#minusWeeks(weeks)

Subtract X weeks from the date

Parameters:
Name Type Description
weeks int

number of weeks to subtract

Source:
Example
Trellinator.now().minusWeeks(1);

(static) Date#monthName()

Find out the name of the month, returned as the full month name eg. August

Source:
Example
Trellinator.now().monthName();

(static) Date#next(day)

Find the next instance of the given day of the week, after the current date

Parameters:
Name Type Description
day string

the name of the day of the week you wish to find the next instance of

Source:
Example
Trellinator.now().next("Monday")

(static) Date#on(date)

Set the day component of this date to the given day, eg. 27

Parameters:
Name Type Description
date int

the day to set this date to, eg. 27

Source:
Example
//1st day of next month
Trellinator.now().addMonths(1).on(1);

(static) Date#previous(day)

Find the previous instance of the given day of the week, before the current date

Parameters:
Name Type Description
day string

the name of the day of the week you wish to find the previous instance of

Source:
Example
Trellinator.now().previous("Monday")

(static) Date#stringFormat(format)

Return a string formatted date from an object

Parameters:
Name Type Description
format string

the desired format. Currently supports only 2 formats: YYYY-MM-DD and HH:MM

Source:
Example
Trellinator.now().stringFormat("YYYY-MM-DD");

(static) Date#timeIsBetween(start, finish)

Any Date object will have this method, allowing you to tell if the time is between 2 values

Parameters:
Name Type Description
start string

A time in 24 hour format eg. 17:00

finish string

A time in 24 hour format eg. 13:00

Source:
Example
if(Trellinator.now().timeIsBetween("9:00","17:00"))

(static) Date#weekOfMonth()

Return the week of the month, starting with 0. Useful if you want to say that you are in the 3rd week of August, for example

Source:
Example
Trellinator.now().weekOfMonth()

(static) RegExp.escape()

Static method to escape user input to be used as part of a regular expression

Source:

(static) Trellinator.addBoardToGlobalCommandGroup(board, group_name)

Add a board name to a global command group. This is used when you create a new board using Trellinator and need that board to inherit a bunch of functionality from a global command group.

Parameters:
Name Type Description
board Board

a Board object to add to the global command group

group_name string

the name of the group to add this board to

Source:
Example
var trellinator = new Trellinator();
var copied = trellinator.board("Template").copy("Project",trellinator.team("Whitefish"));
Trellinator.addBoardToGlobalCommandGroup(copied,"Project Boards");

(static) Trellinator.downloadFileToGoogleDrive()

Static method to escape user input to be used as part of a regular expression

Source:

(static) Trellinator.fastGetSheetByName()

Cache active spreadsheet sheets in an object referenced by name to reduce time to call (for example when executing via node on the command line)

Source:

(static) Trellinator.getRandomArbitrary()

Get a random number between 2 numbers

Source:

(static) Trellinator.isGoogleAppsScript()

Return true if we are running in Google Apps Script environment, false if not (for example when executing via node on the command line)

Source:

(static) Trellinator.log(msg)

Create a log entry in the Info Log when running in Google Apps Script or console.log when running in node

Parameters:
Name Type Description
msg string

the log entry

Source:
Example
Trellinator.log("Oops, what went wrong?");

(static) Trellinator.now()

You can use this instead of new Date() and this means you will be able to get consistency when writing tests by setting Trellinator.fake_now to fixed date and time

Source:

(static) Trellinator.removeBoardFromGlobalCommandGroup(board, group_name)

Remove a board name from a global command group.

Parameters:
Name Type Description
board Board

a Board object to remove from the global command group

group_name string

the name of the group to remove this board from

Source:
Example
Trellinator.removeBoardFromGlobalCommandGroup(new Notification(posted).board(),"Project Boards");