Sha256: 40e805613f4e472225091ac7b99692dcf6c17682784d9cdc03d98d6d7834a23f

Contents?: true

Size: 1.28 KB

Versions: 128

Compression:

Stored size: 1.28 KB

Contents

module Sportradar
  module Api
    module Basketball
      class Venue < Data
        attr_accessor :response, :id, :name, :address, :city, :state, :country, :zip, :capacity, :timezone
        @all_hash = {}
        def self.new(data, **opts)
          existing = @all_hash[data['id']]
          if existing
            existing.update(data, **opts)
            existing
          else
            @all_hash[data['id']] = super
          end
        end
        def self.all
          @all_hash.values
        end

        def initialize(data, **opts)
          @response = data
          @id       = data["id"]

          update(data, **opts)
        end
        def update(data, **opts)
          @name     = data['name']
          @address  = data['address']
          @city     = data['city']
          @state    = data['state']
          @zip      = data['zip']
          @country  = data['country']
          @capacity = data['capacity']
          @timezone = data['timezone']
        end

        def location
          "#{name}, #{city}"
        end

        KEYS_SCHEDULE = ["id", "name", "capacity", "address", "city", "state", "zip", "country"]
      end
    end
  end
end

__END__

sr = Sportradar::Api::Nba.new
lh = sr.league_hierarchy;
t = lh.teams.first;
t.venue.id
t.venue.name
t.venue.city

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
sportradar-api-0.17.1 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.17.0 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.17.0.pre lib/sportradar/api/basketball/venue.rb
sportradar-api-0.16.1 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.16.0 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.15.1 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.15.0 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.14.0 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.26 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.25 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.24 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.23 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.22 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.21 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.20 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.19 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.18 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.17 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.16 lib/sportradar/api/basketball/venue.rb
sportradar-api-0.13.15 lib/sportradar/api/basketball/venue.rb