Class: Yar::StationsResource
- Defined in:
- lib/Yar/resources/stations.rb,
lib/yar/resources/stations.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#between(from:, to:) ⇒ Object
TODO: move to Schedule.between(from: to:) -> Schedule.
-
#list ⇒ Object
def list resp = get(“stations_list/”) Collection.from_response(resp, key: “countries”, type: Region) end.
-
#schedule(station:) ⇒ Object
TODO: move to Schedule.info station: -> Schedule.
Methods inherited from Resource
Constructor Details
This class inherits a constructor from Yar::Resource
Instance Method Details
#between(from:, to:) ⇒ Object
TODO: move to Schedule.between(from: to:) -> Schedule
19 20 21 |
# File 'lib/Yar/resources/stations.rb', line 19 def between(from:, to:) Schedule.new get("search/?from=#{from}&to=#{to}").body end |
#list ⇒ Object
def list
resp = get("stations_list/")
Collection.from_response(resp, key: "countries", type: Region)
end
9 10 11 |
# File 'lib/Yar/resources/stations.rb', line 9 def list Object.new get("stations_list/").body end |
#schedule(station:) ⇒ Object
TODO: move to Schedule.info station: -> Schedule
14 15 16 |
# File 'lib/Yar/resources/stations.rb', line 14 def schedule(station:) Schedule.new get("schedule/?station=#{station}").body end |