Created
January 19, 2012 15:06
-
-
Save rymawby/1640489 to your computer and use it in GitHub Desktop.
Real time TFL London Tube updates - Ideal for use as a Geeklet using with GeekTool / NerdTool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rexml/document' | |
require 'net/http' | |
include REXML | |
@location = 'http://cloud.tfl.gov.uk/TrackerNet/LineStatus' | |
@file = Net::HTTP.get_response(URI.parse(@location)) | |
@xml = REXML::Document.new(@file.body) | |
@xml.elements.each("ArrayOfLineStatus/LineStatus") do |element| | |
puts "#{element[3].attribute("Name")} - #{element[5].attribute("Description")}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment