Class: CTA::BusTracker::RoutesResponse
- Inherits:
-
API::Response
- Object
- API::Response
- CTA::BusTracker::RoutesResponse
- Defined in:
- lib/cta_redux/api/bus_tracker.rb
Instance Attribute Summary collapse
-
#routes ⇒ Array<CTA::Route>
readonly
An array with a full Route object for each route returned by the API, augmented with the color that the API thinks you should be using (which is not always found in the GTFS data).
Attributes inherited from API::Response
#error, #parsed_body, #raw_body, #timestamp
Instance Method Summary collapse
-
#initialize(parsed_body, raw_body, debug) ⇒ RoutesResponse
constructor
A new instance of RoutesResponse.
Constructor Details
#initialize(parsed_body, raw_body, debug) ⇒ RoutesResponse
Returns a new instance of RoutesResponse.
39 40 41 42 43 44 45 46 47 |
# File 'lib/cta_redux/api/bus_tracker.rb', line 39 def initialize(parsed_body, raw_body, debug) super(parsed_body, raw_body, debug) @routes = Array.wrap(parsed_body["bustime_response"]["route"]).map do |r| rt = CTA::Route.where(:route_id => r["rt"]).first rt.route_color = r["rtclr"] rt end end |
Instance Attribute Details
#routes ⇒ Array<CTA::Route> (readonly)
Returns An array with a full Route object for each route returned by the API, augmented with the color that the API thinks you should be using (which is not always found in the GTFS data).
37 38 39 |
# File 'lib/cta_redux/api/bus_tracker.rb', line 37 def routes @routes end |