class FootballApi::Match
Attributes
competition_id[RW]
match_commentary_available[RW]
match_comp_id[RW]
match_date[RW]
match_et_score[RW]
match_events[RW]
match_formatted_date[RW]
match_ft_score[RW]
match_ht_score[RW]
match_id[RW]
match_localteam_id[RW]
match_localteam_name[RW]
match_localteam_score[RW]
match_season_beta[RW]
match_status[RW]
match_time[RW]
match_venue_beta[RW]
match_venue_city_beta[RW]
match_venue_id_beta[RW]
match_visitorteam_id[RW]
match_visitorteam_name[RW]
match_visitorteam_score[RW]
match_week_beta[RW]
static_id[RW]
Public Class Methods
all_from_competition(competition)
click to toggle source
# File lib/football_api/match.rb, line 17 def all_from_competition(competition) @competition_id = competition.is_a?(Competition) ? competition.id : competition Array(response).map { |match| new(match) } end
match_params()
click to toggle source
# File lib/football_api/match.rb, line 23 def match_params self.competition_id ? { comp_id: self.competition_id} : {} end
new(hash = {})
click to toggle source
# File lib/football_api/match.rb, line 39 def initialize(hash = {}) @match_id = hash[:match_id] @static_id = hash[:match_static_id] @match_comp_id = hash[:match_comp_id] @match_date = hash[:match_date] @match_formatted_date = hash[:match_formatted_date] @match_status = hash[:match_status] @match_time = hash[:match_time] @match_commentary_available = hash[:match_commentary_available] @match_localteam_id = hash[:match_localteam_id] @match_localteam_name = hash[:match_localteam_name] @match_localteam_score = hash[:match_localteam_score] @match_visitorteam_id = hash[:match_visitorteam_id] @match_visitorteam_name = hash[:match_visitorteam_name] @match_visitorteam_score = hash[:match_visitorteam_score] @match_ht_score = hash[:match_ht_score] @match_ft_score = hash[:match_ft_score] @match_et_score = hash[:match_et_score] @match_season_beta = hash[:match_season_beta] @match_week_beta = hash[:match_week_beta] @match_venue_beta = hash[:match_venue_beta] @match_venue_id_beta = hash[:match_venue_id_beta] @match_venue_city_beta = hash[:match_venue_city_beta] @match_events = parse_match_events(hash[:match_events]) end
today()
click to toggle source
# File lib/football_api/match.rb, line 12 def today @competition_id = nil Array(response).map { |match| new(match) } end
Public Instance Methods
parse_match_events(arr = [])
click to toggle source
# File lib/football_api/match.rb, line 65 def parse_match_events(arr = []) Array(arr).map { |e| FootballApi::Event.new(e) } end