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) ⇒ Object



32
33
34
# File 'lib/timetable.rb', line 32

def board_for station
  parse_filter(self.class.get(restful_url('stationboard'), @options.merge(query: { station: station, limit: 15})))
end

#search_connection(from, to) ⇒ Object



28
29
30
# File 'lib/timetable.rb', line 28

def search_connection from, to
  parse_filter(self.class.get(restful_url('connections'), @options.merge(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
  parse_filter(self.class.get(restful_url('locations'), @options.merge(query: { query: station_partial})))
end