class Footy::Competition

Attributes

id[RW]
name[RW]
region[RW]

Public Class Methods

all() click to toggle source
# File lib/footy/competition.rb, line 16
def all
  response = Footy::Api.call :Action => 'competitions'
  return from_array(response['Competition']) if response["ERROR"] == "OK"
end
from_array(competitions) click to toggle source
# File lib/footy/competition.rb, line 21
def from_array competitions
  competitions.collect{|c| Competition.new(c["id"], c["name"], c["region"]) }
end
new(id, name, region) click to toggle source
# File lib/footy/competition.rb, line 4
def initialize id, name, region
  @id     = id
  @name   = name
  @region = region
end

Public Instance Methods

fixtures(from, to) click to toggle source
# File lib/footy/competition.rb, line 10
def fixtures from, to
  response = Footy::Api.call :Action => 'fixtures', :comp_id => self.id, :from_date => from.strftime("%d.%m.%Y"), :to_date => to.strftime("%d.%m.%Y")
  return Footy::Fixture.from_array(response['matches']) if response["ERROR"] == "OK"
end