Class: FootStats::ChampionshipClassification
- Defined in:
- lib/foot_stats/championship_classification.rb
Instance Attribute Summary collapse
-
#draws ⇒ Object
Returns the value of attribute draws.
-
#games ⇒ Object
Returns the value of attribute games.
-
#goals_against ⇒ Object
Returns the value of attribute goals_against.
-
#goals_balance ⇒ Object
Returns the value of attribute goals_balance.
-
#goals_for ⇒ Object
Returns the value of attribute goals_for.
-
#group ⇒ Object
Returns the value of attribute group.
-
#home_defeats ⇒ Object
Returns the value of attribute home_defeats.
-
#home_draws ⇒ Object
Returns the value of attribute home_draws.
-
#home_victories ⇒ Object
Returns the value of attribute home_victories.
-
#loss ⇒ Object
Returns the value of attribute loss.
-
#max_point ⇒ Object
Returns the value of attribute max_point.
-
#outside_defeats ⇒ Object
Returns the value of attribute outside_defeats.
-
#outside_draws ⇒ Object
Returns the value of attribute outside_draws.
-
#outside_victories ⇒ Object
Returns the value of attribute outside_victories.
-
#points ⇒ Object
Returns the value of attribute points.
-
#position ⇒ Object
Returns the value of attribute position.
-
#team_source_id ⇒ Object
Returns the value of attribute team_source_id.
-
#use ⇒ Object
Returns the value of attribute use.
-
#victories ⇒ Object
Returns the value of attribute victories.
Class Method Summary collapse
- .all(options = {}) ⇒ Object
- .parse_response(response) ⇒ Object
-
.resource_key ⇒ String
Return the resource key that is fetch from the API response.
-
.resource_name ⇒ String
Return the resource name to request to FootStats.
Methods inherited from Resource
Methods included from AttributeAccessor
Constructor Details
This class inherits a constructor from FootStats::Resource
Instance Attribute Details
#draws ⇒ Object
Returns the value of attribute draws.
3 4 5 |
# File 'lib/foot_stats/championship_classification.rb', line 3 def draws @draws end |
#games ⇒ Object
Returns the value of attribute games.
3 4 5 |
# File 'lib/foot_stats/championship_classification.rb', line 3 def games @games end |
#goals_against ⇒ Object
Returns the value of attribute goals_against.
4 5 6 |
# File 'lib/foot_stats/championship_classification.rb', line 4 def goals_against @goals_against end |
#goals_balance ⇒ Object
Returns the value of attribute goals_balance.
4 5 6 |
# File 'lib/foot_stats/championship_classification.rb', line 4 def goals_balance @goals_balance end |
#goals_for ⇒ Object
Returns the value of attribute goals_for.
4 5 6 |
# File 'lib/foot_stats/championship_classification.rb', line 4 def goals_for @goals_for end |
#group ⇒ Object
Returns the value of attribute group.
3 4 5 |
# File 'lib/foot_stats/championship_classification.rb', line 3 def group @group end |
#home_defeats ⇒ Object
Returns the value of attribute home_defeats.
5 6 7 |
# File 'lib/foot_stats/championship_classification.rb', line 5 def home_defeats @home_defeats end |
#home_draws ⇒ Object
Returns the value of attribute home_draws.
5 6 7 |
# File 'lib/foot_stats/championship_classification.rb', line 5 def home_draws @home_draws end |
#home_victories ⇒ Object
Returns the value of attribute home_victories.
4 5 6 |
# File 'lib/foot_stats/championship_classification.rb', line 4 def home_victories @home_victories end |
#loss ⇒ Object
Returns the value of attribute loss.
3 4 5 |
# File 'lib/foot_stats/championship_classification.rb', line 3 def loss @loss end |
#max_point ⇒ Object
Returns the value of attribute max_point.
5 6 7 |
# File 'lib/foot_stats/championship_classification.rb', line 5 def max_point @max_point end |
#outside_defeats ⇒ Object
Returns the value of attribute outside_defeats.
5 6 7 |
# File 'lib/foot_stats/championship_classification.rb', line 5 def outside_defeats @outside_defeats end |
#outside_draws ⇒ Object
Returns the value of attribute outside_draws.
5 6 7 |
# File 'lib/foot_stats/championship_classification.rb', line 5 def outside_draws @outside_draws end |
#outside_victories ⇒ Object
Returns the value of attribute outside_victories.
4 5 6 |
# File 'lib/foot_stats/championship_classification.rb', line 4 def outside_victories @outside_victories end |
#points ⇒ Object
Returns the value of attribute points.
3 4 5 |
# File 'lib/foot_stats/championship_classification.rb', line 3 def points @points end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/foot_stats/championship_classification.rb', line 3 def position @position end |
#team_source_id ⇒ Object
Returns the value of attribute team_source_id.
3 4 5 |
# File 'lib/foot_stats/championship_classification.rb', line 3 def team_source_id @team_source_id end |
#use ⇒ Object
Returns the value of attribute use.
6 7 8 |
# File 'lib/foot_stats/championship_classification.rb', line 6 def use @use end |
#victories ⇒ Object
Returns the value of attribute victories.
3 4 5 |
# File 'lib/foot_stats/championship_classification.rb', line 3 def victories @victories end |
Class Method Details
.all(options = {}) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/foot_stats/championship_classification.rb', line 8 def self.all(={}) championship_id = .fetch(:championship) request = Request.new self, :Campeonato => championship_id response = request.parse stream_key: "championship-classification-#{championship_id}" return response.error if response.error? updated_response response, end |
.parse_response(response) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/foot_stats/championship_classification.rb', line 18 def self.parse_response(response) response["Classificacoes"]['Classificacao']['Equipe'].collect do |classification| ChampionshipClassification.new( :team_source_id => classification['@Id'].to_i, :group => classification['@Grupo'], :position => classification['Posicao'], :points => classification['Pontos_Ganhos'], :games => classification['Jogos'], :victories => classification['Vitorias'], :draws => classification['Empates'], :loss => classification['Derrotas'], :goals_for => classification['Gols_Pro'], :goals_against => classification['Gols_Contra'], :goals_balance => classification['Saldo_Gols'], :home_victories => classification['Vitorias_Casa'], :outside_victories => classification['Vitorias_Fora'], :home_draws => classification['Empates_Casa'], :outside_draws => classification['Empate_Fora'], :home_defeats => classification['Derrotas_Casa'], :outside_defeats => classification['Derrotas_Fora'], :max_point => classification['Ponto_Maximo'], :use => classification['Aproveitamento'] ) end end |
.resource_key ⇒ String
Return the resource key that is fetch from the API response.
56 57 58 |
# File 'lib/foot_stats/championship_classification.rb', line 56 def self.resource_key 'Campeonato' end |
.resource_name ⇒ String
Return the resource name to request to FootStats.
48 49 50 |
# File 'lib/foot_stats/championship_classification.rb', line 48 def self.resource_name 'ListaClassificacao' end |