Class: Sportradar::Api::Football::Week
- Defined in:
- lib/sportradar/api/football/week.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api ⇒ Object
Returns the value of attribute api.
-
#hierarchy ⇒ Object
Returns the value of attribute hierarchy.
-
#id ⇒ Object
Returns the value of attribute id.
-
#number ⇒ Object
Returns the value of attribute number.
-
#response ⇒ Object
Returns the value of attribute response.
-
#sequence ⇒ Object
Returns the value of attribute sequence.
-
#type ⇒ Object
Returns the value of attribute type.
-
#year ⇒ Object
Returns the value of attribute year.
Instance Method Summary collapse
- #all_attributes ⇒ Object
- #games ⇒ Object
-
#initialize(data = {}, **opts) ⇒ Week
constructor
A new instance of Week.
- #update(data, source: nil, **opts) ⇒ Object
Methods inherited from Data
#attributes, #create_data, #parse_into_array, #parse_into_array_with_options, #parse_out_hashes, #structure_links, #update_data
Constructor Details
#initialize(data = {}, **opts) ⇒ Week
Returns a new instance of Week.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sportradar/api/football/week.rb', line 11 def initialize(data = {}, **opts) # @response = data @api = opts[:api] @id = data['id'] @hierarchy = opts[:hierarchy] @games_hash = {} update(data, **opts) end |
Instance Attribute Details
#api ⇒ Object
Returns the value of attribute api.
5 6 7 |
# File 'lib/sportradar/api/football/week.rb', line 5 def api @api end |
#hierarchy ⇒ Object
Returns the value of attribute hierarchy.
5 6 7 |
# File 'lib/sportradar/api/football/week.rb', line 5 def hierarchy @hierarchy end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/football/week.rb', line 5 def id @id end |
#number ⇒ Object
Returns the value of attribute number.
5 6 7 |
# File 'lib/sportradar/api/football/week.rb', line 5 def number @number end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/sportradar/api/football/week.rb', line 5 def response @response end |
#sequence ⇒ Object
Returns the value of attribute sequence.
5 6 7 |
# File 'lib/sportradar/api/football/week.rb', line 5 def sequence @sequence end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/sportradar/api/football/week.rb', line 5 def type @type end |
#year ⇒ Object
Returns the value of attribute year.
5 6 7 |
# File 'lib/sportradar/api/football/week.rb', line 5 def year @year end |
Instance Method Details
#all_attributes ⇒ Object
7 8 9 |
# File 'lib/sportradar/api/football/week.rb', line 7 def all_attributes [:number] end |
#games ⇒ Object
33 34 35 |
# File 'lib/sportradar/api/football/week.rb', line 33 def games @games_hash.values end |
#update(data, source: nil, **opts) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sportradar/api/football/week.rb', line 22 def update(data, source: nil, **opts) # update stuff @year = opts[:hierarchy].season_year if opts[:hierarchy] @type = opts[:hierarchy].season if opts[:hierarchy] @number = data['number'] || data['title'] || @number @sequence = data['sequence'] || @sequence || @number create_data(@games_hash, data['games'], klass: game_class, week: self, api: api) end |