Sha256: a7f0847503fd1ea9637cbdeabfce777cc7a773d73c912288c6f21f303505f03e
Contents?: true
Size: 1.68 KB
Versions: 1
Compression:
Stored size: 1.68 KB
Contents
module FootStats class Championship < Resource attribute_accessor :source_id, :name, :has_classification, :current_round, :total_rounds # Retrieve all championships from FootStats # # @return [Array] # def self.all(options = {}) response = Request.new(self).parse stream_key: 'championships' return response.error if response.error? updated_response response, options end def self.parse_response(response) response.collect do |championship| new( :source_id => championship['@Id'].to_i, :name => championship['@Nome'], :has_classification => championship['@TemClassificacao'] == 'True', :current_round => championship['@RodadaATual'].to_i, :total_rounds => championship['@Rodadas'].to_i ) end end # Return the resource name to request to FootStats. # # @return [String] # def self.resource_name 'ListaCampeonatos' end # Return the resource key that is fetch from the API response. # # @return [String] # def self.resource_key 'Campeonato' end # Return the Championship classification. # # @return [Array] # def classification(options = {}) ChampionshipClassification.all(options.merge(championship: source_id)) end # Return the Championship teams. # # @return [Array] # def teams(options = {}) Team.all(options.merge(championship: source_id)) end # Return all the Championship matches. # # @return [Array] # def matches(options = {}) Match.all(options.merge(championship: source_id)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
foot_stats-0.1.0 | lib/foot_stats/championship.rb |