View Source MBTA.Api.Route (mbta_sdk v0.1.0)

API calls for all endpoints tagged Route.

Summary

Functions

List of routes. ## Names and Descriptions There are 3 attributes with increasing details for naming and describing the route. 1. /data/{index}/attributes/short_name 2. /data/{index}/attributes/long_name 3. /data/{index}/attributes/description ## Directions /data/{index}/attributes/direction_names is the only place to convert the direction_id used throughout the rest of the API to human-readable names. ## Type /data/{index}/attributes/type corresponds to GTFS routes.txt route_type. | Value | Name | Example | |-------|---------------|------------| | 0 | Light Rail | Green Line | | 1 | Heavy Rail | Red Line | | 2 | Commuter Rail | | | 3 | Bus | | | 4 | Ferry | |

Show a particular route by the route's id. ## Names and Descriptions There are 3 attributes with increasing details for naming and describing the route. 1. /data/attributes/short_name 2. /data/attributes/long_name 3. /data/attributes/description ## Directions /data/attributes/direction_names is the only place to convert the direction_id used throughout the rest of the API to human-readable names. ## Type /data/attributes/type corresponds to GTFS routes.txt route_type. | Value | Name | Example | |-------|---------------|------------| | 0 | Light Rail | Green Line | | 1 | Heavy Rail | Red Line | | 2 | Commuter Rail | | | 3 | Bus | | | 4 | Ferry | |

Functions

Link to this function

api_web_route_controller_index(connection, opts \\ [])

View Source
@spec api_web_route_controller_index(
  Tesla.Env.client(),
  keyword()
) ::
  {:ok, MBTA.Model.Forbidden.t()}
  | {:ok, MBTA.Model.TooManyRequests.t()}
  | {:ok, MBTA.Model.Routes.t()}
  | {:ok, MBTA.Model.BadRequest.t()}
  | {:error, Tesla.Env.t()}

List of routes. ## Names and Descriptions There are 3 attributes with increasing details for naming and describing the route. 1. /data/{index}/attributes/short_name 2. /data/{index}/attributes/long_name 3. /data/{index}/attributes/description ## Directions /data/{index}/attributes/direction_names is the only place to convert the direction_id used throughout the rest of the API to human-readable names. ## Type /data/{index}/attributes/type corresponds to GTFS routes.txt route_type. | Value | Name | Example | |-------|---------------|------------| | 0 | Light Rail | Green Line | | 1 | Heavy Rail | Red Line | | 2 | Commuter Rail | | | 3 | Bus | | | 4 | Ferry | |

Parameters

  • connection (MBTA.Connection): Connection to server
  • opts (keyword): Optional parameters
    • :"page[offset]" (integer()): Offset (0-based) of first element in the page
    • :"page[limit]" (integer()): Max number of elements to return
    • :sort (String.t): Results can be sorted by the id or any /data/{index}/attributes key. Assumes ascending; may be prefixed with '-' for descending | JSON pointer | Direction | sort | |--------------|-----------|------------| | /data/{index}/attributes/color | ascending | color | | /data/{index}/attributes/color | descending | -color | | /data/{index}/attributes/description | ascending | description | | /data/{index}/attributes/description | descending | -description | | /data/{index}/attributes/direction_destinations | ascending | direction_destinations | | /data/{index}/attributes/direction_destinations | descending | -direction_destinations | | /data/{index}/attributes/direction_names | ascending | direction_names | | /data/{index}/attributes/direction_names | descending | -direction_names | | /data/{index}/attributes/fare_class | ascending | fare_class | | /data/{index}/attributes/fare_class | descending | -fare_class | | /data/{index}/attributes/long_name | ascending | long_name | | /data/{index}/attributes/long_name | descending | -long_name | | /data/{index}/attributes/short_name | ascending | short_name | | /data/{index}/attributes/short_name | descending | -short_name | | /data/{index}/attributes/sort_order | ascending | sort_order | | /data/{index}/attributes/sort_order | descending | -sort_order | | /data/{index}/attributes/text_color | ascending | text_color | | /data/{index}/attributes/text_color | descending | -text_color | | /data/{index}/attributes/type | ascending | type | | /data/{index}/attributes/type | descending | -type |

    • :"fields[route]" (String.t): Fields to include with the response. Multiple fields MUST be a comma-separated (U+002C COMMA, ",") list. Note that fields can also be selected for included data types: see the V3 API Best Practices for an example.
    • :include (String.t): Relationships to include. stop line route_patterns The value of the include parameter *MUST be a comma-separated (U+002C COMMA, ",") list of relationship paths. A relationship path is a dot-separated (U+002E FULL-STOP, ".") list of relationship names. JSONAPI "include" behavior stop can only be included when filter[stop] is also specified.
    • :"filter[stop]" (String.t): Filter by /data/{index}/relationships/stop/data/id. Multiple IDs MUST be a comma-separated (U+002C COMMA, ",") list.
    • :"filter[type]" (String.t): | Value | Name | Example | |-------|---------------|------------| | 0 | Light Rail | Green Line | | 1 | Heavy Rail | Red Line | | 2 | Commuter Rail | | | 3 | Bus | | | 4 | Ferry | | Multiple route_type MUST be a comma-separated (U+002C COMMA, ",") list.

    • :"filter[direction_id]" (String.t): Filter by direction of travel along the route. Must be used in conjuction with filter[route] to apply. The meaning of direction_id varies based on the route. You can programmatically get the direction names from /routes /data/{index}/attributes/direction_names or /routes/{id} /data/attributes/direction_names. When combined with stop_id, filters by routes which stop at that stop when traveling in a particular direction
    • :"filter[date]" (Date.t): Filter by date that route is active The active date is the service date. Trips that begin between midnight and 3am are considered part of the previous service day. The format is ISO8601 with the template of YYYY-MM-DD.
    • :"filter[id]" (String.t): Filter by multiple IDs. Multiple IDs MUST be a comma-separated (U+002C COMMA, ",") list.

Returns

  • {:ok, MBTA.Model.Routes.t} on success
  • {:error, Tesla.Env.t} on failure
Link to this function

api_web_route_controller_show(connection, id, opts \\ [])

View Source
@spec api_web_route_controller_show(Tesla.Env.client(), String.t(), keyword()) ::
  {:ok, MBTA.Model.NotAcceptable.t()}
  | {:ok, MBTA.Model.Forbidden.t()}
  | {:ok, MBTA.Model.Route.t()}
  | {:ok, MBTA.Model.TooManyRequests.t()}
  | {:ok, MBTA.Model.NotFound.t()}
  | {:ok, MBTA.Model.BadRequest.t()}
  | {:error, Tesla.Env.t()}

Show a particular route by the route's id. ## Names and Descriptions There are 3 attributes with increasing details for naming and describing the route. 1. /data/attributes/short_name 2. /data/attributes/long_name 3. /data/attributes/description ## Directions /data/attributes/direction_names is the only place to convert the direction_id used throughout the rest of the API to human-readable names. ## Type /data/attributes/type corresponds to GTFS routes.txt route_type. | Value | Name | Example | |-------|---------------|------------| | 0 | Light Rail | Green Line | | 1 | Heavy Rail | Red Line | | 2 | Commuter Rail | | | 3 | Bus | | | 4 | Ferry | |

Parameters

  • connection (MBTA.Connection): Connection to server
  • id (String.t): Unique identifier for route
  • opts (keyword): Optional parameters
    • :"fields[route]" (String.t): Fields to include with the response. Multiple fields MUST be a comma-separated (U+002C COMMA, ",") list. Note that fields can also be selected for included data types: see the V3 API Best Practices for an example.
    • :include (String.t): Relationships to include. line route_patterns The value of the include parameter MUST be a comma-separated (U+002C COMMA, ",") list of relationship paths. A relationship path is a dot-separated (U+002E FULL-STOP, ".") list of relationship names. JSONAPI "include" behavior

Returns

  • {:ok, MBTA.Model.Route.t} on success
  • {:error, Tesla.Env.t} on failure