Class: Transport::Timetable

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/timetable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTimetable

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

#parseObject

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