Sha256: d4eb6356e009a8c7368afdc1efb9172e2b4aee5b07fc8f648c24bf956720b489

Contents?: true

Size: 1.22 KB

Versions: 128

Compression:

Stored size: 1.22 KB

Contents

module Sportradar
  module Api
    module Baseball
      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']

          @surface  = data['surface']

          # dimensions
        end

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

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

__END__

Version data entries

128 entries across 128 versions & 1 rubygems

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