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