Class: OnebusawaySDK::Resources::TripsForRoute

Inherits:
Object
  • Object
show all
Defined in:
lib/onebusaway_sdk/resources/trips_for_route.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ TripsForRoute

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TripsForRoute.

Parameters:



40
41
42
# File 'lib/onebusaway_sdk/resources/trips_for_route.rb', line 40

def initialize(client:)
  @client = client
end

Instance Method Details

#list(route_id, include_schedule: nil, include_status: nil, time: nil, request_options: {}) ⇒ OnebusawaySDK::Models::TripsForRouteListResponse

Some parameter documentations has been truncated, see Models::TripsForRouteListParams for more details.

Search for active trips for a specific route.

Parameters:

  • route_id (String)

    The ID of the route.

  • include_schedule (Boolean)

    Determine whether full schedule elements are included. Defaults to false.

  • include_status (Boolean)

    Determine whether full tripStatus elements with real-time information are includ

  • time (Integer)

    Query the system at a specific time. Useful for testing.

  • request_options (OnebusawaySDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
# File 'lib/onebusaway_sdk/resources/trips_for_route.rb', line 26

def list(route_id, params = {})
  parsed, options = OnebusawaySDK::TripsForRouteListParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["api/where/trips-for-route/%1$s.json", route_id],
    query: parsed.transform_keys(include_schedule: "includeSchedule", include_status: "includeStatus"),
    model: OnebusawaySDK::Models::TripsForRouteListResponse,
    options: options
  )
end