Class: Sportradar::Api::Mma::Roster
- Inherits:
-
Data
- Object
- Data
- Sportradar::Api::Mma::Roster
show all
- Defined in:
- lib/sportradar/api/mma/roster.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) ⇒ Roster
Returns a new instance of Roster.
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/sportradar/api/mma/roster.rb', line 7
def initialize(data, **opts)
@response = data
@api = opts[:api]
@generated = response['generated']
@fighters_hash = {}
@referees_hash = {}
@judges_hash = {}
update(data)
end
|
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
5
6
7
|
# File 'lib/sportradar/api/mma/roster.rb', line 5
def id
@id
end
|
#name ⇒ Object
Returns the value of attribute name.
5
6
7
|
# File 'lib/sportradar/api/mma/roster.rb', line 5
def name
@name
end
|
#response ⇒ Object
Returns the value of attribute response.
5
6
7
|
# File 'lib/sportradar/api/mma/roster.rb', line 5
def response
@response
end
|
#scheduled ⇒ Object
Returns the value of attribute scheduled.
5
6
7
|
# File 'lib/sportradar/api/mma/roster.rb', line 5
def scheduled
@scheduled
end
|
#venue ⇒ Object
Returns the value of attribute venue.
5
6
7
|
# File 'lib/sportradar/api/mma/roster.rb', line 5
def venue
@venue
end
|
Instance Method Details
#api ⇒ Object
50
51
52
|
# File 'lib/sportradar/api/mma/roster.rb', line 50
def api
@api ||= Sportradar::Api::Mma.new
end
|
#fighters ⇒ Object
20
21
22
23
|
# File 'lib/sportradar/api/mma/roster.rb', line 20
def fighters
@fighters_hash ||= update_fighters(response)
@fighters_hash.values
end
|
#judges ⇒ Object
28
29
30
31
|
# File 'lib/sportradar/api/mma/roster.rb', line 28
def judges
@judges_hash ||= update_judges(response)
@judges_hash.values
end
|
#referees ⇒ Object
24
25
26
27
|
# File 'lib/sportradar/api/mma/roster.rb', line 24
def referees
@referees_hash ||= update_referees(response)
@referees_hash.values
end
|
#update(data) ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/sportradar/api/mma/roster.rb', line 33
def update(data)
self
end
|
#update_fighters(data) ⇒ Object
41
42
43
|
# File 'lib/sportradar/api/mma/roster.rb', line 41
def update_fighters(data)
create_data(@fighters_hash, response.dig('fighters', 'fighter'), klass: Fighter, api: api, roster: self)
end
|
#update_judges(data) ⇒ Object
47
48
49
|
# File 'lib/sportradar/api/mma/roster.rb', line 47
def update_judges(data)
create_data(@judges_hash, response.dig('judges', 'judge'), klass: Judge, api: api, roster: self)
end
|
#update_referees(data) ⇒ Object
44
45
46
|
# File 'lib/sportradar/api/mma/roster.rb', line 44
def update_referees(data)
create_data(@referees_hash, response.dig('referees', 'referee'), klass: Referee, api: api, roster: self)
end
|