Created
November 23, 2010 14:37
-
-
Save PatrickTulskie/711855 to your computer and use it in GitHub Desktop.
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 'rubygems' | |
require 'httparty' | |
class NFLStream | |
attr_accessor :current_scores | |
include HTTParty | |
format :json | |
base_uri "http://www.nfl.com" | |
def dump_current_scores | |
get_current_scores! | |
@current_scores.each do |score_row| | |
puts score_row.inspect | |
end | |
end | |
private | |
def get_current_scores! | |
response = self.class.get('/liveupdate/scorestrip/scorestrip.json') | |
@current_scores = response ? response['ss'] : [] | |
return @current_scores | |
end | |
end | |
nfl = NFLStream.new | |
scores = nfl.dump_current_scores |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment