Class: Transport::Timetable
- Inherits:
-
Object
- Object
- Transport::Timetable
- Includes:
- HTTParty
- Defined in:
- lib/timetable.rb
Instance Attribute Summary collapse
-
#parse ⇒ Object
Returns the value of attribute parse.
Instance Method Summary collapse
- #board_for(station, limit = 15) ⇒ Object
-
#initialize ⇒ Timetable
constructor
default_params :output => ‘json’.
- #search_connection(from, to) ⇒ Object
- #search_station(station_partial) ⇒ Object
Constructor Details
#initialize ⇒ Timetable
default_params :output => ‘json’
18 19 20 21 22 |
# File 'lib/timetable.rb', line 18 def initialize @version = 'v1' @parse = true @options = { query: { } } end |
Instance Attribute Details
#parse ⇒ Object
Returns the value of attribute parse.
12 13 14 |
# File 'lib/timetable.rb', line 12 def parse @parse end |
Instance Method Details
#board_for(station, limit = 15) ⇒ Object
32 33 34 |
# File 'lib/timetable.rb', line 32 def board_for station, limit=15 request 'stationboard', query: { station: station, limit: limit} end |
#search_connection(from, to) ⇒ Object
28 29 30 |
# File 'lib/timetable.rb', line 28 def search_connection from, to request 'connections', query: { from: from, to: to} end |
#search_station(station_partial) ⇒ Object
24 25 26 |
# File 'lib/timetable.rb', line 24 def search_station station_partial request 'locations', query: { query: station_partial } end |