Class: SamtrafikenAPI::ResrobotStops
- Defined in:
- lib/samtrafiken_api/resrobot_stops.rb
Overview
Samtrafiken ResRobot Stolptidtabeller API.
Documentation: http://www.trafiklab.se/api/resrobot-stolptidtabeller
Instance Attribute Summary
Attributes inherited from APIBase
Class Method Summary collapse
-
.uris ⇒ Object
debug_output $stdout.
Instance Method Summary collapse
-
#get_departures(query) ⇒ Hash
Endpoint: GetDepartures Documentation: http://www.trafiklab.se/api/resrobot-stolptidtabeller/getdepartures.
-
#set_mode(mode) ⇒ Object
Set the API mode to use either real time or time table data.
Methods inherited from APIBase
Constructor Details
This class inherits a constructor from SamtrafikenAPI::APIBase
Class Method Details
.uris ⇒ Object
debug_output $stdout
19 20 21 22 23 24 |
# File 'lib/samtrafiken_api/resrobot_stops.rb', line 19 def self.uris { timetable: 'https://api.trafiklab.se/samtrafiken/resrobotstops', realtime: 'https://api.trafiklab.se/samtrafiken/resrobotstopssuper' } end |
Instance Method Details
#get_departures(query) ⇒ Hash
Endpoint: GetDepartures Documentation: http://www.trafiklab.se/api/resrobot-stolptidtabeller/getdepartures
45 46 47 48 |
# File 'lib/samtrafiken_api/resrobot_stops.rb', line 45 def get_departures query @response = self.class.get('/GetDepartures.json', :query => query) return read_response @response end |
#set_mode(mode) ⇒ Object
Set the API mode to use either real time or time table data.
31 32 33 34 35 36 37 |
# File 'lib/samtrafiken_api/resrobot_stops.rb', line 31 def set_mode mode if self.class.uris.has_key? mode self.class.base_uri self.class.uris[mode] else raise "Invalid API mode." end end |