Sha256: e98bc03eee1459462eb2bde4913e25c5d93565545012ab2a14f68799be92c2b4

Contents?: true

Size: 1.27 KB

Versions: 107

Compression:

Stored size: 1.27 KB

Contents

module Sportradar
  module Api
    module Football
      class Week < Data
        attr_accessor :response, :id, :number, :api, :hierarchy, :year, :type, :sequence

        def all_attributes
          [:number]
        end

        def initialize(data = {}, **opts)
          # @response = data
          @api        = opts[:api]
          @id         = data['id']
          @hierarchy  = opts[:hierarchy]

          @games_hash = {}

          update(data, **opts)
        end

        def update(data, source: nil, **opts)
          # update stuff
          @year = opts[:hierarchy].season_year  if opts[:hierarchy]
          @type = opts[:hierarchy].season       if opts[:hierarchy]

          @number   = data['number'] || data['title'] || @number
          @sequence = data['sequence'] || @sequence || @number

          create_data(@games_hash, data['games'],   klass: game_class,   week: self, api: api)
        end

        def games
          @games_hash.values
        end

      end
    end
  end
end

__END__



ncaafb = Sportradar::Api::Football::Ncaafb.new
ncaafb = Sportradar::Api::Football::Ncaafb.new
res1 = ncaafb.get_schedule;
res2 = ncaafb.get_weekly_schedule;

ncaafb = Sportradar::Api::Football::Ncaafb.new
gg = ncaafb.games;
g = gg.first;
g.week
g.week_number
g.year
g.type

Version data entries

107 entries across 107 versions & 1 rubygems

Version Path
sportradar-api-0.20.2 lib/sportradar/api/football/week.rb
sportradar-api-0.20.1 lib/sportradar/api/football/week.rb
sportradar-api-0.20.0 lib/sportradar/api/football/week.rb
sportradar-api-0.20.0.pre2 lib/sportradar/api/football/week.rb
sportradar-api-0.20.0.pre lib/sportradar/api/football/week.rb
sportradar-api-0.19.6 lib/sportradar/api/football/week.rb
sportradar-api-0.19.5 lib/sportradar/api/football/week.rb
sportradar-api-0.19.4 lib/sportradar/api/football/week.rb
sportradar-api-0.19.3 lib/sportradar/api/football/week.rb
sportradar-api-0.19.2 lib/sportradar/api/football/week.rb
sportradar-api-0.19.1 lib/sportradar/api/football/week.rb
sportradar-api-0.19.0 lib/sportradar/api/football/week.rb
sportradar-api-0.18.1 lib/sportradar/api/football/week.rb
sportradar-api-0.18.0 lib/sportradar/api/football/week.rb
sportradar-api-0.17.6 lib/sportradar/api/football/week.rb
sportradar-api-0.17.5 lib/sportradar/api/football/week.rb
sportradar-api-0.17.5.pre lib/sportradar/api/football/week.rb
sportradar-api-0.17.4 lib/sportradar/api/football/week.rb
sportradar-api-0.17.3 lib/sportradar/api/football/week.rb
sportradar-api-0.17.2 lib/sportradar/api/football/week.rb