Class: Yar::StationsResource

Inherits:
Resource show all
Defined in:
lib/Yar/resources/stations.rb,
lib/yar/resources/stations.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

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

#listObject

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