Sha256: b366854ae5aba3e89d2677cc139769be67ca8d7062e6a1269aaa963698b3da4f

Contents?: true

Size: 1.3 KB

Versions: 21

Compression:

Stored size: 1.3 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']  if data['sequence']

          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::Hierarchy.new
ncaafb = Sportradar::Api::Football::Ncaafb::Hierarchy.new
res1 = ncaafb.get_schedule;
res2 = ncaafb.get_weekly_schedule;

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

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
sportradar-api-0.11.21 lib/sportradar/api/football/week.rb
sportradar-api-0.11.20 lib/sportradar/api/football/week.rb
sportradar-api-0.11.19 lib/sportradar/api/football/week.rb
sportradar-api-0.11.18 lib/sportradar/api/football/week.rb
sportradar-api-0.11.17 lib/sportradar/api/football/week.rb
sportradar-api-0.11.16 lib/sportradar/api/football/week.rb
sportradar-api-0.11.15 lib/sportradar/api/football/week.rb
sportradar-api-0.11.14 lib/sportradar/api/football/week.rb
sportradar-api-0.11.13 lib/sportradar/api/football/week.rb
sportradar-api-0.11.12 lib/sportradar/api/football/week.rb
sportradar-api-0.11.11 lib/sportradar/api/football/week.rb
sportradar-api-0.11.10 lib/sportradar/api/football/week.rb
sportradar-api-0.11.9 lib/sportradar/api/football/week.rb
sportradar-api-0.11.8 lib/sportradar/api/football/week.rb
sportradar-api-0.11.7 lib/sportradar/api/football/week.rb
sportradar-api-0.11.6 lib/sportradar/api/football/week.rb
sportradar-api-0.11.5 lib/sportradar/api/football/week.rb
sportradar-api-0.11.4 lib/sportradar/api/football/week.rb
sportradar-api-0.11.3 lib/sportradar/api/football/week.rb
sportradar-api-0.11.1 lib/sportradar/api/football/week.rb