Class: Tramtracker::API
- Inherits:
-
Object
- Object
- Tramtracker::API
- Defined in:
- lib/tramtracker/api.rb
Constant Summary collapse
- DATE_FORMAT =
"/Date(%Q%z)/"
Instance Attribute Summary collapse
-
#stop_id ⇒ Object
Returns the value of attribute stop_id.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(stop_id) ⇒ API
constructor
A new instance of API.
Constructor Details
#initialize(stop_id) ⇒ API
Returns a new instance of API.
10 11 12 |
# File 'lib/tramtracker/api.rb', line 10 def initialize(stop_id) @stop_id = stop_id end |
Instance Attribute Details
#stop_id ⇒ Object
Returns the value of attribute stop_id.
8 9 10 |
# File 'lib/tramtracker/api.rb', line 8 def stop_id @stop_id end |
Instance Method Details
#get ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/tramtracker/api.rb', line 14 def get api_response["responseObject"].collect do |tram| { route: tram["RouteNo"], minutes: minutes_until(tram["PredictedArrivalDateTime"]) } end end |