Class: Tpg

Inherits:
Object
  • Object
show all
Defined in:
lib/tpg.rb

Constant Summary collapse

VERSION =
'v1'.freeze
DOMAIN =
'https://prod.ivtr-od.tpg.ch'.freeze

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Tpg

Returns a new instance of Tpg.



9
10
11
# File 'lib/tpg.rb', line 9

def initialize(api_key)
  @api_key = api_key
end

Instance Method Details

#all_next_departures(params = {}) ⇒ Object

@param: stopCode, lineCode, destinationCode



37
38
39
# File 'lib/tpg.rb', line 37

def all_next_departures(params = {})
  query('GetAllNextDepartures', params)
end

#disruptionsObject

@param: -



65
66
67
# File 'lib/tpg.rb', line 65

def disruptions
  query('GetDisruptions')
end

#lines_colorsObject

@param: -



58
59
60
# File 'lib/tpg.rb', line 58

def lines_colors
  query('GetLinesColors')
end

#next_departures(params = {}) ⇒ Object

@param: stopCode, departureCode, linesCode, destinationCode



30
31
32
# File 'lib/tpg.rb', line 30

def next_departures(params = {})
  query('GetNextDepartures', params)
end

#physical_stops(params = {}) ⇒ Object

@param: stopCode, stopName



23
24
25
# File 'lib/tpg.rb', line 23

def physical_stops(params = {})
  query('GetPhysicalStops', params)['stops']
end

#stops(params = {}) ⇒ Object

@param: stopCode, stopName, line, latitude, longitude



16
17
18
# File 'lib/tpg.rb', line 16

def stops(params = {})
  query('GetStops', params)['stops']
end

#thermometer(params = {}) ⇒ Object

@param: departureCode



44
45
46
# File 'lib/tpg.rb', line 44

def thermometer(params = {})
  query('GetThermometer', params)
end

#thermometer_physical_stops(params = {}) ⇒ Object

@param: departureCode



51
52
53
# File 'lib/tpg.rb', line 51

def thermometer_physical_stops(params = {})
  query('GetThermometerPhysicalStops', params)
end