Class: Sportradar::Api::Baseball::Venue
- Defined in:
- lib/sportradar/api/baseball/venue.rb
Constant Summary collapse
- KEYS_SCHEDULE =
["id", "name", "capacity", "address", "city", "state", "zip", "country"]
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#capacity ⇒ Object
Returns the value of attribute capacity.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#response ⇒ Object
Returns the value of attribute response.
-
#state ⇒ Object
Returns the value of attribute state.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
-
#zip ⇒ Object
Returns the value of attribute zip.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data, **opts) ⇒ Venue
constructor
A new instance of Venue.
- #location ⇒ Object
- #update(data, **opts) ⇒ Object
Methods inherited from Data
#all_attributes, #attributes, #create_data, #parse_into_array, #parse_into_array_with_options, #parse_out_hashes, #structure_links, #update_data
Constructor Details
#initialize(data, **opts) ⇒ Venue
Returns a new instance of Venue.
20 21 22 23 24 25 |
# File 'lib/sportradar/api/baseball/venue.rb', line 20 def initialize(data, **opts) @response = data @id = data["id"] update(data, **opts) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def address @address end |
#capacity ⇒ Object
Returns the value of attribute capacity.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def capacity @capacity end |
#city ⇒ Object
Returns the value of attribute city.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def country @country end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def name @name end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def response @response end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def state @state end |
#timezone ⇒ Object
Returns the value of attribute timezone.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def timezone @timezone end |
#zip ⇒ Object
Returns the value of attribute zip.
5 6 7 |
# File 'lib/sportradar/api/baseball/venue.rb', line 5 def zip @zip end |
Class Method Details
.all ⇒ Object
16 17 18 |
# File 'lib/sportradar/api/baseball/venue.rb', line 16 def self.all @all_hash.values end |
.new(data, **opts) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/sportradar/api/baseball/venue.rb', line 7 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 |
Instance Method Details
#location ⇒ Object
41 42 43 |
# File 'lib/sportradar/api/baseball/venue.rb', line 41 def location "#{name}, #{city}" end |
#update(data, **opts) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/sportradar/api/baseball/venue.rb', line 26 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 |