Class: FootStats::Live

Inherits:
Resource show all
Defined in:
lib/foot_stats/live.rb,
lib/foot_stats/live_card.rb,
lib/foot_stats/live_goal.rb,
lib/foot_stats/live_team.rb,
lib/foot_stats/live_player.rb

Defined Under Namespace

Classes: Card, Goal, Player, Team

Constant Summary collapse

MAPPED_PARAMS =
{
  source_id:     '@IdPartida',
  score:         '@Placar',
  penalty_score: '@PlacarPenaltis',
  date:          '@Data',
  period:        '@Periodo',
  referee:       '@Arbitro',
  stadium:       '@Estadio',
  city:          '@Cidade',
  country:       '@Pais',
  has_narration: '@TemNarracao',
  round:         '@Rodada',
  phase:         '@Fase',
  cup:           '@Taca',
  group:         '@Grupo',
  home_team:     'Mandante',
  visitor_team:  'Visitante'
}

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#initialize, updated_response

Methods included from AttributeAccessor

#attributes, included

Constructor Details

This class inherits a constructor from FootStats::Resource

Class Method Details

.find(match_id, options = {}) ⇒ Live

Retrieve live data of a match

Returns:



54
55
56
57
58
59
# File 'lib/foot_stats/live.rb', line 54

def find(match_id, options={})
  response = Request.new(self, :IdPartida => match_id).parse stream_key: 'live_match'
  return response.error if response.error?

  updated_response response, options
end

.resource_keyString

Return the resource key that is fetch from the API response.

Returns:

  • (String)


73
74
75
# File 'lib/foot_stats/live.rb', line 73

def resource_key
  nil
end

.resource_nameString

Return the resource name to request to FootStats.

Returns:

  • (String)


65
66
67
# File 'lib/foot_stats/live.rb', line 65

def resource_name
  'AoVivo'
end

Instance Method Details

#home_penalty_scoreObject



39
40
41
# File 'lib/foot_stats/live.rb', line 39

def home_penalty_score
  penalty_score[:home]
end

#home_scoreObject



31
32
33
# File 'lib/foot_stats/live.rb', line 31

def home_score
  score[:home]
end

#visitor_penalty_scoreObject



43
44
45
# File 'lib/foot_stats/live.rb', line 43

def visitor_penalty_score
  penalty_score[:visitor]
end

#visitor_scoreObject



35
36
37
# File 'lib/foot_stats/live.rb', line 35

def visitor_score
  score[:visitor]
end