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.11.28 lib/sportradar/api/football/week.rb
sportradar-api-0.11.27 lib/sportradar/api/football/week.rb
sportradar-api-0.11.26 lib/sportradar/api/football/week.rb
sportradar-api-0.11.25 lib/sportradar/api/football/week.rb
sportradar-api-0.11.24 lib/sportradar/api/football/week.rb
sportradar-api-0.11.23 lib/sportradar/api/football/week.rb
sportradar-api-0.11.22 lib/sportradar/api/football/week.rb