Class: OnebusawaySDK::Resources::ArrivalsAndDeparturesForLocation

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ArrivalsAndDeparturesForLocation

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

Parameters:



65
66
67
# File 'lib/onebusaway_sdk/resources/arrivals_and_departures_for_location.rb', line 65

def initialize(client:)
  @client = client
end

Instance Method Details

#list(lat:, lon:, empty_returns_not_found: nil, lat_span: nil, lon_span: nil, max_count: nil, minutes_after: nil, minutes_before: nil, radius: nil, route_type: nil, time: nil, request_options: {}) ⇒ OnebusawaySDK::Models::ArrivalsAndDeparturesForLocationListResponse

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

Returns real-time arrival and departure data for stops within a bounding box or radius centered on a specific location.

Parameters:

  • lat (Float)

    The latitude coordinate of the search center.

  • lon (Float)

    The longitude coordinate of the search center.

  • empty_returns_not_found (Boolean)

    If true, returns a 404 Not Found error instead of an empty result.

  • lat_span (Float)

    Sets the latitude limits of the search bounding box.

  • lon_span (Float)

    Sets the longitude limits of the search bounding box.

  • max_count (Integer)

    The max size of the list of nearby stops and arrivals to return. Defaults to 250

  • minutes_after (Integer)

    Include arrivals and departures this many minutes after the query time.

  • minutes_before (Integer)

    Include arrivals and departures this many minutes before the query time.

  • radius (Float)

    The search radius in meters.

  • route_type (String)

    Optional list of GTFS routeTypes to filter by (comma delimited) e.g. “1,2,3”.

  • time (Integer)

    By default, returns the status right now. Can be queried at a specific time (mil

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

Returns:

See Also:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/onebusaway_sdk/resources/arrivals_and_departures_for_location.rb', line 42

def list(params)
  parsed, options = OnebusawaySDK::ArrivalsAndDeparturesForLocationListParams.dump_request(params)
  query = OnebusawaySDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "api/where/arrivals-and-departures-for-location.json",
    query: query.transform_keys(
      empty_returns_not_found: "emptyReturnsNotFound",
      lat_span: "latSpan",
      lon_span: "lonSpan",
      max_count: "maxCount",
      minutes_after: "minutesAfter",
      minutes_before: "minutesBefore",
      route_type: "routeType"
    ),
    model: OnebusawaySDK::Models::ArrivalsAndDeparturesForLocationListResponse,
    options: options
  )
end