Class: Metromobilite::Model::Time

Inherits:
Object
  • Object
show all
Defined in:
lib/metromobilite/model/time.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(jsonData) ⇒ Time

Instantiates a new Time object from received JSON data :call-seq:

Time.new(jsonObj)
jsonData_Hash

The Time JSON hash object received from the API



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/metromobilite/model/time.rb', line 14

def initialize(jsonData)
    @stopId = jsonData['stopId']
    @stopName = jsonData['stopName']
    @scheduledArrival = jsonData['scheduledArrival']
    @scheduledDeparture = jsonData['scheduledDeparture']
    @realtimeArrival = jsonData['realtimeArrival']
    @realtimeDeparture = jsonData['realtimeDeparture']
    @arrivalDelay = jsonData['arrivalDelay']
    @departureDelay = jsonData['departureDelay']
    @timepoint = jsonData['timepoint']
    @realtime = jsonData['realtime']
    @serviceDay = jsonData['serviceDay']
    @tripId = jsonData['tripId']
end

Instance Attribute Details

#arrivalDelayObject (readonly)

Returns the value of attribute arrivalDelay.



35
36
37
# File 'lib/metromobilite/model/time.rb', line 35

def arrivalDelay
  @arrivalDelay
end

#departureDelayObject (readonly)

Returns the value of attribute departureDelay.



36
37
38
# File 'lib/metromobilite/model/time.rb', line 36

def departureDelay
  @departureDelay
end

#realtimeObject (readonly)

Returns the value of attribute realtime.



38
39
40
# File 'lib/metromobilite/model/time.rb', line 38

def realtime
  @realtime
end

#realtimeArrivalObject (readonly)

Returns the value of attribute realtimeArrival.



33
34
35
# File 'lib/metromobilite/model/time.rb', line 33

def realtimeArrival
  @realtimeArrival
end

#realtimeDepartureObject (readonly)

Returns the value of attribute realtimeDeparture.



34
35
36
# File 'lib/metromobilite/model/time.rb', line 34

def realtimeDeparture
  @realtimeDeparture
end

#scheduledArrivalObject (readonly)

Returns the value of attribute scheduledArrival.



31
32
33
# File 'lib/metromobilite/model/time.rb', line 31

def scheduledArrival
  @scheduledArrival
end

#scheduledDepartureObject (readonly)

Returns the value of attribute scheduledDeparture.



32
33
34
# File 'lib/metromobilite/model/time.rb', line 32

def scheduledDeparture
  @scheduledDeparture
end

#serviceDayObject (readonly)

Returns the value of attribute serviceDay.



39
40
41
# File 'lib/metromobilite/model/time.rb', line 39

def serviceDay
  @serviceDay
end

#stopIdObject (readonly)

Returns the value of attribute stopId.



29
30
31
# File 'lib/metromobilite/model/time.rb', line 29

def stopId
  @stopId
end

#stopNameObject (readonly)

Returns the value of attribute stopName.



30
31
32
# File 'lib/metromobilite/model/time.rb', line 30

def stopName
  @stopName
end

#timepointObject (readonly)

Returns the value of attribute timepoint.



37
38
39
# File 'lib/metromobilite/model/time.rb', line 37

def timepoint
  @timepoint
end

#tripIdObject (readonly)

Returns the value of attribute tripId.



40
41
42
# File 'lib/metromobilite/model/time.rb', line 40

def tripId
  @tripId
end

Instance Method Details

#to_json(opts = nil) ⇒ Object



42
43
44
45
46
# File 'lib/metromobilite/model/time.rb', line 42

def to_json(opts = nil)
    hash = {}
    instance_variables.each {|var| hash[var.to_s.delete("@")] = instance_variable_get(var) }
    hash.to_json
end