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.13.14 lib/sportradar/api/football/week.rb
sportradar-api-0.13.13 lib/sportradar/api/football/week.rb
sportradar-api-0.13.12 lib/sportradar/api/football/week.rb
sportradar-api-0.13.11 lib/sportradar/api/football/week.rb
sportradar-api-0.13.10 lib/sportradar/api/football/week.rb
sportradar-api-0.13.9 lib/sportradar/api/football/week.rb
sportradar-api-0.13.8 lib/sportradar/api/football/week.rb
sportradar-api-0.13.7 lib/sportradar/api/football/week.rb
sportradar-api-0.13.6 lib/sportradar/api/football/week.rb
sportradar-api-0.13.5 lib/sportradar/api/football/week.rb
sportradar-api-0.13.4 lib/sportradar/api/football/week.rb
sportradar-api-0.13.3 lib/sportradar/api/football/week.rb
sportradar-api-0.13.2 lib/sportradar/api/football/week.rb
sportradar-api-0.13.1 lib/sportradar/api/football/week.rb
sportradar-api-0.13.0 lib/sportradar/api/football/week.rb
sportradar-api-0.12.3 lib/sportradar/api/football/week.rb
sportradar-api-0.12.2 lib/sportradar/api/football/week.rb
sportradar-api-0.12.1 lib/sportradar/api/football/week.rb
sportradar-api-0.12.0 lib/sportradar/api/football/week.rb
sportradar-api-0.11.69 lib/sportradar/api/football/week.rb