Class: Howard::Train

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

Instance Method Summary collapse

Constructor Details

#initialize(api_response) ⇒ Train

Returns a new instance of Train.



3
4
5
# File 'lib/howard/train.rb', line 3

def initialize(api_response)
  @api_response = api_response
end

Instance Method Details

#headingObject



7
8
9
# File 'lib/howard/train.rb', line 7

def heading
  @api_response.fetch("heading", "").to_i
end

#latitudeObject



11
12
13
# File 'lib/howard/train.rb', line 11

def latitude
  @api_response.fetch("lat", "").to_f
end

#longitudeObject



15
16
17
# File 'lib/howard/train.rb', line 15

def longitude
  @api_response.fetch("lon", "").to_f
end

#runObject



19
20
21
# File 'lib/howard/train.rb', line 19

def run
  @api_response["rn"]
end