new Favorite( type, sequence, parameters [, options ] )

Description

RT Favorite

Representation of a Right Track User Favorite. This can be a saved Station, Trip or Train with the associated parameters and optional options.

The following describes the format for the Favorite parameters and options.

Station

Parameters:

 {
			   stop: {
			     id: 'Stop ID',
			     name: 'Stop Name'
			   }
			 }
			

Options:

Currently, there are no options for a Favorite Station.

Trip

Parameters:

 {
			   origin: {
			     id: 'Stop ID'
			     name: 'Stop Name'
			   },
			   destination: {
			     id 'Stop ID'
			     name: 'Stop Name'
			   }
			 }
			

Options:

{
			  allowTransfers: true
			}
			

Transit

Parameters:

 {
			   agency: {
			     id: 'Transit Agency ID',
			     name: 'Transit Name'
			   },
			   division: {
			     code: 'Transit Division Code',
			     name: 'Transit Division Name'
			   },
			   divisionCodes: ['subway', 'A']
			 }
			

Options:

Currently, there are no options for a Favorite Transit.

Module: rt/Favorite

Parameters
Name Type Attributes Default Description
type int

Favorite Type

sequence int

Favorite Sequence (1, 2, etc...)

parameters Object

Favorite Station or Trip or Transit Parameters

options Object <optional>
{}

Favorite Station or Trip or Transit Options

Details

Members


type :int

Description

Value indicating the Favorite type

Details
int

sequence :int

Description

The sequence of the Favorite in the User's list

Details
int

parameters :Object

Description

The Favorite's Parameters

Details
Object

options :Object

Description

The Favorite's Options

Details
Object

Methods


isStation() → {boolean}

Description

Check if the Favorite is a Favorite Station

Returns

true if Station

Details

isTrip() → {boolean}

Description

Check if the Favorite is a Favorite Trip

Returns

true if Trip

Details

isTransit() → {boolean}

Description

Check if the Favorite is a Favorite Transit

Returns

true if Transit

Details

<static> createStation( stop, sequence [, opts ] ) → {Favorite}

Description

Favorite Factory: create a Favorite Station

Parameters
Name Type Attributes Default Description
stop Stop

The Stop to save as a Favorite Station

sequence int

The Favorite sequence

opts Object <optional>
{}

Station Options

Returns

Favorite Station

Details

<static> createTrip( origin, destination, sequence [, opts ] ) → {Favorite}

Description

Favorite Factory: create a Favorite Trip

Parameters
Name Type Attributes Default Description
origin Stop

The origin of the Favorite Trip

destination Stop

The destination of the Favorite Trip

sequence int

The Favorite sequence

opts Object <optional>
{}

Trip Options

Returns

Favorite Trip

Details

<static> createTransit( agency, division, divisionCodes, sequence [, opts ] ) → {Favorite}

Description

Favorite Factory: create a Favorite Transit Agency/Division...

Parameters
Name Type Attributes Default Description
agency TransitAgency

The Transit Agency of the Favorite Transit

division TransitDivision

The Transit Division of the Favorite Transit

divisionCodes Array.<String>

The Transit Division codes (codes of parent(s) and favorite)

sequence int

The Favorite sequence

opts Object <optional>
{}

Transit Options

Returns

Favorite Transit

Details

<static> sortBySequence( a, b ) → {number}

Description

Sort Favorites by sequence (ascending)

Parameters
Name Type Description
a Favorite

first Favorite

b Favorite

second Favorite

Returns

compare integer

Details

Type Definitions


FavoriteStationParameters

Description

The Parameters for a Favorite Station

Properties
Name Type Description
stop Stop

The Favorite Station

Name Type Description
id String

Stop Id

name String

Stop Name

Details
Object

FavoriteStationOptions

Description

The Options for a Favorite Station

Details
Object

FavoriteTripParameters

Description

The Parameters for a Favorite Trip

Properties
Name Type Description
origin Stop

The Origin Stop

Name Type Description
id String

Origin Id

name String

Origin Name

destination Stop

The Destination Stop

Name Type Description
id String

Destination Id

name String

Destination Name

Details
Object

FavoriteTripOptions

Description

The Options for a Favorite Trip

Properties
Name Type Description
allowTransfers boolean

Allow the Trip Result to include transfers

Details
Object

FavoriteTransitParameters

Description

The Parameters for a Favorite Transit

Properties
Name Type Description
agency TransitAgency

The Transit Agency

Name Type Description
code String

The Transit Agency code

name String

The Transit Agency name

division TransitDivision

The Transit Division

Name Type Description
code String

The Transit Division code

name String

The Transit Division name

divisionCodes Array.<String>

The array of Division codes (includes parent(s) and favorite)

Details
Object

FavoriteTransitOptions

Description

The Options for a Favorite Transit

Details
Object