Class: CTA::BusTracker::RoutesResponse

Inherits:
API::Response show all
Defined in:
lib/cta_redux/api/bus_tracker.rb

Instance Attribute Summary collapse

Attributes inherited from API::Response

#error, #parsed_body, #raw_body, #timestamp

Instance Method Summary collapse

Constructor Details

#initialize(parsed_body, raw_body, debug) ⇒ 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

#routesArray<CTA::Route> (readonly)



37
38
39
# File 'lib/cta_redux/api/bus_tracker.rb', line 37

def routes
  @routes
end