Favorite

Favorite

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'
   },
   line: {
     code: 'Transit Line Code'
     name: 'Transit Line Name'
   }
 }

Options:

Currently, there are no options for a Favorite Transit.

Module: rt/Favorite

Constructor

new Favorite(type, sequence, parameters, optionsopt)

Source:

Create a new Favorite with the specified information

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

Members

(static, constant) FAVORITE_TYPE_STATION :number

Source:
Default Value:
  • 1

Favorite Type: Station

Type:
  • number

(static, constant) FAVORITE_TYPE_TRANSIT :number

Source:
Default Value:
  • 3

Favorite Type: Transit

Type:
  • number

(static, constant) FAVORITE_TYPE_TRIP :number

Source:
Default Value:
  • 2

Favorite Type: Trip

Type:
  • number

options :Object

Source:

The Favorite's Options

Type:
  • Object

parameters :Object

Source:

The Favorite's Parameters

Type:
  • Object

sequence :int

Source:

The sequence of the Favorite in the User's list

Type:
  • int

type :int

Source:

Value indicating the Favorite type

Type:
  • int

Methods

(static) createStation(stop, sequence, optsopt) → {Favorite}

Source:

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

Type
Favorite

(static) createTransit(agency, division, line, sequence, optsopt) → {Favorite}

Source:

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

Parameters:
Name Type Attributes Default Description
agency TransitAgency

The Transit Agency of the Favorite Transit

division TransitDivision | undefined

The Transit Division of the Favorite Transit

line TransitLine | undefined

The Transit Line of the Favorite Transit

sequence int

The Favorite sequence

opts Object <optional>
{}

Transit Options

Returns:

Favorite Transit

Type
Favorite

(static) createTrip(origin, destination, sequence, optsopt) → {Favorite}

Source:

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

Type
Favorite

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

Source:

Sort Favorites by sequence (ascending)

Parameters:
Name Type Description
a Favorite

first Favorite

b Favorite

second Favorite

Returns:

compare integer

Type
number

isStation() → {boolean}

Source:

Check if the Favorite is a Favorite Station

Returns:

true if Station

Type
boolean

isTransit() → {boolean}

Source:

Check if the Favorite is a Favorite Transit

Returns:

true if Transit

Type
boolean

isTrip() → {boolean}

Source:

Check if the Favorite is a Favorite Trip

Returns:

true if Trip

Type
boolean

Type Definitions

FavoriteStationOptions

Source:

The Options for a Favorite Station

Type:
  • Object

FavoriteStationParameters

Source:
Properties:
Name Type Description
stop Stop

The Favorite Station

Properties
Name Type Description
id String

Stop Id

name String

Stop Name

The Parameters for a Favorite Station

Type:
  • Object

FavoriteTransitOptions

Source:

The Options for a Favorite Transit

Type:
  • Object

FavoriteTransitParameters

Source:
Properties:
Name Type Description
agency TransitAgency

The Transit Agency

Properties
Name Type Description
code String

The Transit Agency code

name String

The Transit Agency name

division TransitDivision

The Transit Division

Properties
Name Type Description
code String

The Transit Division code

name String

The Transit Division name

line TransitLine

The Transit Line

Properties
Name Type Description
code String

The Transit Line code

name String

The Transit Line name

The Parameters for a Favorite Transit

Type:
  • Object

FavoriteTripOptions

Source:
Properties:
Name Type Description
allowTransfers boolean

Allow the Trip Result to include transfers

The Options for a Favorite Trip

Type:
  • Object

FavoriteTripParameters

Source:
Properties:
Name Type Description
origin Stop

The Origin Stop

Properties
Name Type Description
id String

Origin Id

name String

Origin Name

destination Stop

The Destination Stop

Properties
Name Type Description
id String

Destination Id

name String

Destination Name

The Parameters for a Favorite Trip

Type:
  • Object