Sha256: 4f32b9021d5ef5a3a0180fb380cee25715cac262e404911064258f7f81f2673b

Contents?: true

Size: 1 KB

Versions: 127

Compression:

Stored size: 1 KB

Contents

module Sportradar
  module Api
    module Football
      class Ncaafb
        class Division < Data
          attr_accessor :response, :id, :name, :alias

          def initialize(data, **opts)
            # @response = data
            @api      = opts[:api]

            @id    = data["id"]
            @name  = data["name"]
            @alias = data["alias"] || data["id"]
            update(data, **opts)
          end

          def update(data, **opts)
            @conferences_hash = create_data({}, data["conferences"], klass: Conference, division: self, api: @api) if data["conferences"]
          end

          def conferences
            @conferences_hash.values
          end

          def conference(code_name)
            conferences_by_name[code_name]
          end

          def conferences_by_name
            @conferences_by_name ||= conferences.map { |c| [c.id, c] }.to_h
          end

          def teams
            conferences.flat_map(&:teams)
          end

        end
      end
    end
  end
end

Version data entries

127 entries across 127 versions & 1 rubygems

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