Class: Howard::Train
- Inherits:
-
Object
- Object
- Howard::Train
- Defined in:
- lib/howard/train.rb
Instance Method Summary collapse
- #heading ⇒ Object
-
#initialize(api_response) ⇒ Train
constructor
A new instance of Train.
- #latitude ⇒ Object
- #longitude ⇒ Object
- #run ⇒ Object
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
#heading ⇒ Object
7 8 9 |
# File 'lib/howard/train.rb', line 7 def heading @api_response.fetch("heading", "").to_i end |
#latitude ⇒ Object
11 12 13 |
# File 'lib/howard/train.rb', line 11 def latitude @api_response.fetch("lat", "").to_f end |
#longitude ⇒ Object
15 16 17 |
# File 'lib/howard/train.rb', line 15 def longitude @api_response.fetch("lon", "").to_f end |
#run ⇒ Object
19 20 21 |
# File 'lib/howard/train.rb', line 19 def run @api_response["rn"] end |