Class: Sportradar::Api::Football::Nfl::Conference

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/football/nfl/conference.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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) ⇒ Conference

Returns a new instance of Conference.



8
9
10
11
12
13
14
15
16
# File 'lib/sportradar/api/football/nfl/conference.rb', line 8

def initialize(data, **opts)
  @response = data
  @api      = opts[:api]

  @id = data["id"]
  @divisions_hash = {}

  update(data, **opts)
end

Instance Attribute Details

#aliasObject

Returns the value of attribute alias.



6
7
8
# File 'lib/sportradar/api/football/nfl/conference.rb', line 6

def alias
  @alias
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/sportradar/api/football/nfl/conference.rb', line 6

def id
  @id
end

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/sportradar/api/football/nfl/conference.rb', line 6

def name
  @name
end

#responseObject

Returns the value of attribute response.



6
7
8
# File 'lib/sportradar/api/football/nfl/conference.rb', line 6

def response
  @response
end

Instance Method Details

#divisionsObject



26
27
28
# File 'lib/sportradar/api/football/nfl/conference.rb', line 26

def divisions
  @divisions_hash.values
end

#update(data, **opts) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/sportradar/api/football/nfl/conference.rb', line 18

def update(data, **opts)
  @name   = data["name"]  if data["name"]
  @alias  = data["alias"] if data["alias"]
  create_data(@divisions_hash, data["divisions"], klass: Division, conference: self, api: @api)

  self
end