class NBA::Game
Constants
- BASE_URI
Public Class Methods
get_games(date=today_date)
click to toggle source
# File lib/nba/game.rb, line 4 def self.get_games(date=today_date) url = BASE_URI+"/#{date}/games.json?callback=cb" res = HTTP.get(url) if res.code == 200 # THE RESPONSE HERE IS JSONP, SO WE NEED TO PARSE IT len = res.body.to_s.length return JSON.parse(res.body.to_s[3,(len-5)]) end return res.code end
today_date()
click to toggle source
# File lib/nba/game.rb, line 16 def self.today_date d = Date.today d.strftime('%Y%m%d') end