Class: OnebusawaySDK::Resources::TripForVehicle

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ TripForVehicle

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 TripForVehicle.

Parameters:



46
47
48
# File 'lib/onebusaway_sdk/resources/trip_for_vehicle.rb', line 46

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(vehicle_id, include_schedule: nil, include_status: nil, include_trip: nil, time: nil, request_options: {}) ⇒ OnebusawaySDK::Models::TripForVehicleRetrieveResponse

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

Retrieve trip for a specific vehicle

Parameters:

  • vehicle_id (String)

    ID of the vehicle to retrieve trip details for.

  • include_schedule (Boolean)

    Determines whether full <schedule/> element is included in the <tripDetails/> se

  • include_status (Boolean)

    Determines whether the full <status/> element is included in the <tripDetails/>

  • include_trip (Boolean)

    Determines whether full <trip/> element is included in the <references/> section

  • time (Integer)

    Time parameter to query the system at a specific time (optional).

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

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/onebusaway_sdk/resources/trip_for_vehicle.rb', line 28

def retrieve(vehicle_id, params = {})
  parsed, options = OnebusawaySDK::TripForVehicleRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["api/where/trip-for-vehicle/%1$s.json", vehicle_id],
    query: parsed.transform_keys(
      include_schedule: "includeSchedule",
      include_status: "includeStatus",
      include_trip: "includeTrip"
    ),
    model: OnebusawaySDK::Models::TripForVehicleRetrieveResponse,
    options: options
  )
end