class Footy::Api

Public Class Methods

call(options={}) click to toggle source
# File lib/footy/api.rb, line 6
def call options={}
  response = JSON.parse(Net::HTTP.get_response(URI.parse(url(options))).body)
  raise Footy::FootyError, response["ERROR"] unless response["ERROR"] == "OK"
  response
end

Private Class Methods

url(options={}) click to toggle source
# File lib/footy/api.rb, line 13
def url options={}
  options['APIKey'] = Footy.configuration.api_key
  options.inject(Footy.configuration.api_url){|q, o| q += "#{o.first}=#{o.last}&"}
end