Skip to content

Instantly share code, notes, and snippets.

@rymawby
Created August 14, 2012 11:38
Show Gist options
  • Save rymawby/3348536 to your computer and use it in GitHub Desktop.
Save rymawby/3348536 to your computer and use it in GitHub Desktop.
Push TFL tube status updates to your iPhone using prowly
require 'rubygems'
require 'prowly'
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)
@output = ""
@xml.elements.each("ArrayOfLineStatus/LineStatus") do |element|
@output = @output + "#{element[3].attribute("Name")} - #{element[5].attribute("Description")}\n"
end
Prowly.notify do |n|
n.apikey = "???????????????????????????????"
n.priority = Prowly::Notification::Priority::MODERATE
n.application = "TFL Update"
n.event = "Alert"
n.description = @output
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment