Class: Station

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(system_event) ⇒ Station

Returns a new instance of Station.



6
7
8
9
10
11
# File 'lib/common/station.rb', line 6

def initialize(system_event)
  @id = system_event[]
  @location = ''
  @lines = system_event[]
  @last_updated = system_event[]
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/common/station.rb', line 4

def id
  @id
end

#last_updatedObject

Returns the value of attribute last_updated.



4
5
6
# File 'lib/common/station.rb', line 4

def last_updated
  @last_updated
end

#linesObject

Returns the value of attribute lines.



4
5
6
# File 'lib/common/station.rb', line 4

def lines
  @lines
end

#locationObject

Returns the value of attribute location.



4
5
6
# File 'lib/common/station.rb', line 4

def location
  @location
end

Instance Method Details

#as_json(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/common/station.rb', line 13

def as_json(options={})
  {
      id: @id,
      location: @location,
      lines: @lines,
      last_updated: @last_updated
  }
end

#to_json(*options) ⇒ Object



22
23
24
# File 'lib/common/station.rb', line 22

def to_json(*options)
  as_json(*options).to_json(*options)
end