Class: Ldbws::Request::GetStationBoard

Inherits:
Base
  • Object
show all
Defined in:
lib/ldbws/request/get_station_board.rb

Overview

Returns an arrival or departure board for a given station. Corresponds to GetStationBoardRequest in the LDBWS schema.

Parameters

crs

the CRS code for the station (required)

num_rows

the number of services to include (optional)

filter_crs

a CRS code for a station to filter arrivals from/departures to (optional)

filter_type

either ‘to’ or ‘from’ (optional)

time_offset

the offset from the current time—in minutes—to return departure information (optional).

time_window

how far into the future—relative to :time_offset—to return service information for (optional).

Direct Known Subclasses

GetStationBoardWithDetails

Constant Summary collapse

SCHEMA =

:nodoc:

Dry::Schema.Params do
  required(:crs).filled(Types::Crs)
  optional(:num_rows).filled(:integer)
  optional(:filter_crs).filled(Types::Crs)
  optional(:filter_type).filled(Types::FilterType)
  optional(:time_offset).filled(:integer)
  optional(:time_window).filled(:integer)
end
RESULT_XPATH =

:nodoc:

"GetStationBoardResult"
RESULT_TYPE =

:nodoc:

Ldbws::ResponseTypes::StationBoard

Instance Method Summary collapse

Methods inherited from Base

#from_soap, #initialize, #to_soap

Constructor Details

This class inherits a constructor from Ldbws::Request::Base

Instance Method Details

#to_soap_paramsObject

:nodoc:



34
35
36
37
38
39
40
41
42
43
# File 'lib/ldbws/request/get_station_board.rb', line 34

def to_soap_params
  @params.tap do |params|
    # CRSes should always be upcased
    params[:crs].upcase!
    params[:filter_crs].upcase! if params[:filter_crs]

    # filter type isn’t needed if we’re not filtering
    params.delete(:filter_type) unless params[:filter_crs]
  end
end