Module: StationMaster::Schedule::Find
Instance Method Summary collapse
- #find_station_arrivals(station_code, time = Time.now) ⇒ Object
- #find_station_departures(station_code, time = Time.now) ⇒ Object
Instance Method Details
#find_station_arrivals(station_code, time = Time.now) ⇒ Object
6 7 8 9 10 |
# File 'lib/station_master/schedule/find.rb', line 6 def find_station_arrivals(station_code, time = Time.now) MultiJson::load(remote_call(:arrivals, { station_code: station_code, time: format_time(time) }), symbolize_keys: true).inject([]) do |array, arrival_hash| array << Arrival.new(arrival_hash) end end |
#find_station_departures(station_code, time = Time.now) ⇒ Object
12 13 14 15 16 |
# File 'lib/station_master/schedule/find.rb', line 12 def find_station_departures(station_code, time = Time.now) MultiJson::load(remote_call(:departures, { station_code: station_code, time: format_time(time) }), symbolize_keys: true).inject([]) do |array, arrival_hash| array << Departure.new(arrival_hash) end end |