class FootballApi::MatchTeam

Attributes

id[RW]
players[RW]

Public Class Methods

new(hash = {}, key) click to toggle source
# File lib/football_api/match_team.rb, line 6
def initialize(hash = {}, key)
  @id = hash[:comm_match_id]
  @players = parse_players(hash, key)
end

Public Instance Methods

parse_players(hash = {}, key) click to toggle source
# File lib/football_api/match_team.rb, line 11
def parse_players(hash = {}, key)
  players = []
  Array(hash[:comm_match_teams][key][:player]).each do |player|
    players << FootballApi::Player.new(player)
  end
  Array(hash[:comm_match_subs][key][:player]).each do |player|
    players << FootballApi::Player.new(player)
  end
  players
end