View Source MBTA.Api.Vehicle (mbta_sdk v0.1.0)
API calls for all endpoints tagged Vehicle.
Summary
Functions
List of vehicles (buses, ferries, and trains) ## Direction ### World To figure out which way the vehicle is pointing at the location, use /data/{index}/attributes/bearing. This can be the compass bearing, or the direction towards the next stop or intermediate location. ### Trip To get the direction around the stops in the trip use /data/{index}/attributes/direction_id. ## Location ### World Use /data/{index}/attributes/latitude and /data/{index}/attributes/longitude to get the location of a vehicle. ### Trip Use /data/{index}/attributes/current_stop_sequence to get the stop number along the trip. Useful for linear stop indicators. Position relative to the current stop is in /data/{index}/attributes/current_status. ## Movement ### World Use /data/{index}/attributes/speed to get the speed of the vehicle in meters per second.
Single vehicle (bus, ferry, or train) ## Direction ### World To figure out which way the vehicle is pointing at the location, use /data/attributes/bearing. This can be the compass bearing, or the direction towards the next stop or intermediate location. ### Trip To get the direction around the stops in the trip use /data/attributes/direction_id. ## Location ### World Use /data/attributes/latitude and /data/attributes/longitude to get the location of a vehicle. ### Trip Use /data/attributes/current_stop_sequence to get the stop number along the trip. Useful for linear stop indicators. Position relative to the current stop is in /data/attributes/current_status. ## Movement ### World Use /data/attributes/speed to get the speed of the vehicle in meters per second.
Functions
@spec api_web_vehicle_controller_index( Tesla.Env.client(), keyword() ) :: {:ok, MBTA.Model.Forbidden.t()} | {:ok, MBTA.Model.TooManyRequests.t()} | {:ok, MBTA.Model.Vehicles.t()} | {:ok, MBTA.Model.BadRequest.t()} | {:error, Tesla.Env.t()}
List of vehicles (buses, ferries, and trains) ## Direction ### World To figure out which way the vehicle is pointing at the location, use /data/{index}/attributes/bearing. This can be the compass bearing, or the direction towards the next stop or intermediate location. ### Trip To get the direction around the stops in the trip use /data/{index}/attributes/direction_id. ## Location ### World Use /data/{index}/attributes/latitude and /data/{index}/attributes/longitude to get the location of a vehicle. ### Trip Use /data/{index}/attributes/current_stop_sequence to get the stop number along the trip. Useful for linear stop indicators. Position relative to the current stop is in /data/{index}/attributes/current_status. ## Movement ### World Use /data/{index}/attributes/speed to get the speed of the vehicle in meters per second.
Parameters
connection(MBTA.Connection): Connection to serveropts(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}/attributeskey. Assumes ascending; may be prefixed with '-' for descending | JSON pointer | Direction |sort| |--------------|-----------|------------| |/data/{index}/attributes/bearing| ascending |bearing| |/data/{index}/attributes/bearing| descending |-bearing| |/data/{index}/attributes/carriages| ascending |carriages| |/data/{index}/attributes/carriages| descending |-carriages| |/data/{index}/attributes/current_status| ascending |current_status| |/data/{index}/attributes/current_status| descending |-current_status| |/data/{index}/attributes/current_stop_sequence| ascending |current_stop_sequence| |/data/{index}/attributes/current_stop_sequence| descending |-current_stop_sequence| |/data/{index}/attributes/direction_id| ascending |direction_id| |/data/{index}/attributes/direction_id| descending |-direction_id| |/data/{index}/attributes/label| ascending |label| |/data/{index}/attributes/label| descending |-label| |/data/{index}/attributes/latitude| ascending |latitude| |/data/{index}/attributes/latitude| descending |-latitude| |/data/{index}/attributes/longitude| ascending |longitude| |/data/{index}/attributes/longitude| descending |-longitude| |/data/{index}/attributes/occupancy_status| ascending |occupancy_status| |/data/{index}/attributes/occupancy_status| descending |-occupancy_status| |/data/{index}/attributes/speed| ascending |speed| |/data/{index}/attributes/speed| descending |-speed| |/data/{index}/attributes/updated_at| ascending |updated_at| |/data/{index}/attributes/updated_at| descending |-updated_at|:"fields[vehicle]"(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.tripstoprouteThe 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 | include | Description | |---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |trip| The trip which the vehicle is currently operating. | |stop| The vehicle's current (whencurrent_statusis STOPPED_AT) or next* stop. | |route| The one route that is designated for that trip, as in GTFStrips.txt. A trip might also provide service on other routes, identified by the MBTA'smulti_route_trips.txtGTFS extension.filter[route]does consider the multi_route_trips GTFS extension, so it is possible to filter for one route and get a different route included in the response. |:"filter[id]"(String.t): Filter by multiple IDs. Multiple IDs MUST be a comma-separated (U+002C COMMA, ",") list. Cannot be combined with any other filter.:"filter[trip]"(String.t): Filter by/data/{index}/relationships/trip/data/id. Multiple/data/{index}/relationships/trip/data/idMUST be a comma-separated (U+002C COMMA, ",") list. Cannot be combined with any other filter.:"filter[label]"(String.t): Filter by label. MultiplelabelMUST be a comma-separated (U+002C COMMA, ",") list.:"filter[route]"(String.t): Filter by route. If the vehicle is on a multi-route trip, it will be returned for any of the routes. Multipleroute_idMUST 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 withfilter[route]to apply. The meaning ofdirection_idvaries based on the route. You can programmatically get the direction names from/routes/data/{index}/attributes/direction_namesor/routes/{id}/data/attributes/direction_names. Only used iffilter[route]is also present.:"filter[route_type]"(String.t): Filter by route_type: https://developers.google.com/transit/gtfs/reference/routes-file. Multipleroute_typeMUST be a comma-separated (U+002C COMMA, ",") list.
Returns
{:ok, MBTA.Model.Vehicles.t}on success{:error, Tesla.Env.t}on failure
@spec api_web_vehicle_controller_show(Tesla.Env.client(), String.t(), keyword()) :: {:ok, MBTA.Model.NotAcceptable.t()} | {:ok, MBTA.Model.Forbidden.t()} | {:ok, MBTA.Model.TooManyRequests.t()} | {:ok, MBTA.Model.Vehicle.t()} | {:ok, MBTA.Model.NotFound.t()} | {:error, Tesla.Env.t()}
Single vehicle (bus, ferry, or train) ## Direction ### World To figure out which way the vehicle is pointing at the location, use /data/attributes/bearing. This can be the compass bearing, or the direction towards the next stop or intermediate location. ### Trip To get the direction around the stops in the trip use /data/attributes/direction_id. ## Location ### World Use /data/attributes/latitude and /data/attributes/longitude to get the location of a vehicle. ### Trip Use /data/attributes/current_stop_sequence to get the stop number along the trip. Useful for linear stop indicators. Position relative to the current stop is in /data/attributes/current_status. ## Movement ### World Use /data/attributes/speed to get the speed of the vehicle in meters per second.
Parameters
connection(MBTA.Connection): Connection to serverid(String.t): Unique identifier for a vehicleopts(keyword): Optional parameters:"fields[vehicle]"(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.tripstoprouteThe 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 | include | Description | |---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |trip| The trip which the vehicle is currently operating. | |stop| The vehicle's current (whencurrent_statusis STOPPED_AT) or next* stop. | |route| The one route that is designated for that trip, as in GTFStrips.txt. A trip might also provide service on other routes, identified by the MBTA'smulti_route_trips.txtGTFS extension.filter[route]does consider the multi_route_trips GTFS extension, so it is possible to filter for one route and get a different route included in the response. |
Returns
{:ok, MBTA.Model.Vehicle.t}on success{:error, Tesla.Env.t}on failure