Module: TtcFeed

Defined in:
lib/ttc_feed.rb,
lib/ttc_feed/version.rb

Constant Summary collapse

VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.num_vehicles(route_id) ⇒ Object



12
13
14
15
16
# File 'lib/ttc_feed.rb', line 12

def self.num_vehicles(route_id)
  body = Faraday.get(TtcUrls.vehicle_locations(route_id)).body
  doc = Nokogiri::XML(body)
  doc.css("vehicle").length
end

.streetcar_xml_data(last_timestamp = nil) ⇒ Object



6
7
8
9
10
# File 'lib/ttc_feed.rb', line 6

def self.streetcar_xml_data(last_timestamp = nil)
  [
    ["512", Faraday.get(TtcUrls.vehicle_locations("512", last_timestamp)).body]
  ]
end