Sha256: f390adb677664747dc4cfb83e5e0b839fc46153197add403d27842db2654e943

Contents?: true

Size: 1.18 KB

Versions: 42

Compression:

Stored size: 1.18 KB

Contents

module Sportradar
  module Api
    module Baseball
      class Venue < Data
        attr_accessor :response, :id, :name, :address, :city, :state, :country, :zip, :capacity
        @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']

          @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

42 entries across 42 versions & 1 rubygems

Version Path
sportradar-api-0.10.35 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.34 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.33 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.32 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.31 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.30 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.29 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.28 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.27 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.26 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.25 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.24 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.23 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.22 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.21 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.20 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.19 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.18 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.17 lib/sportradar/api/baseball/venue.rb
sportradar-api-0.10.16 lib/sportradar/api/baseball/venue.rb