Class: CTA::BusTracker::StopsResponse
- Inherits:
-
API::Response
- Object
- API::Response
- CTA::BusTracker::StopsResponse
- Defined in:
- lib/cta_redux/api/bus_tracker.rb
Instance Attribute Summary collapse
-
#stops ⇒ Array<CTA::Stop>
readonly
An array with full Stop objects that correspond to the stops returned from the API.
Attributes inherited from API::Response
#error, #parsed_body, #raw_body, #timestamp
Instance Method Summary collapse
-
#initialize(parsed_body, raw_body, debug) ⇒ StopsResponse
constructor
A new instance of StopsResponse.
Constructor Details
#initialize(parsed_body, raw_body, debug) ⇒ StopsResponse
Returns a new instance of StopsResponse.
66 67 68 69 70 71 |
# File 'lib/cta_redux/api/bus_tracker.rb', line 66 def initialize(parsed_body, raw_body, debug) super(parsed_body, raw_body, debug) @stops = Array.wrap(parsed_body["bustime_response"]["stop"]).map do |s| CTA::Stop.where(:stop_id => s["stpid"]).first || CTA::Stop.new_from_api_response(s) end end |
Instance Attribute Details
#stops ⇒ Array<CTA::Stop> (readonly)
Note:
Some stops returned from BusTracker are not found in GTFS data, so cta_redux creates them on the fly. These stops are for seasonal routes. An email has been sent to the CTA asking why they’re not included in the GTFS data (they should be).
Returns An array with full Stop objects that correspond to the stops returned from the API.
64 65 66 |
# File 'lib/cta_redux/api/bus_tracker.rb', line 64 def stops @stops end |