class FootballApi::Fixture
Attributes
comp_id[RW]
from_date[RW]
match_date[RW]
to_date[RW]
match[RW]
match_events[RW]
match_timer[RW]
Public Class Methods
fixture_params()
click to toggle source
# File lib/football_api/fixture.rb, line 21 def fixture_params [:comp_id, :match_date, :from_date, :to_date].each_with_object({}) do |symb, opts| opts.merge!(symb => send(symb) ) if send(symb) end end
new(hash = {})
click to toggle source
# File lib/football_api/fixture.rb, line 30 def initialize(hash = {}) @match = parse_match(hash) @match_timer = hash[:match_timer] @match_events = parse_match_events(hash[:match_events]) end
where(options = {})
click to toggle source
# File lib/football_api/fixture.rb, line 10 def where(options = {}) @comp_id = options.delete(:comp_id) @match_date = options.delete(:match_date) @from_date = options.delete(:from_date) @to_date = options.delete(:to_date) response.map{ |fixture| new (fixture) } end
Public Instance Methods
parse_match(hash = {})
click to toggle source
# File lib/football_api/fixture.rb, line 36 def parse_match(hash = {}) FootballApi::Match.new(hash) end
parse_match_events(arr = [])
click to toggle source
# File lib/football_api/fixture.rb, line 40 def parse_match_events(arr = []) Array(arr).map { |e| FootballApi::Event.new(e) } end