Class: Sportradar::Api::Soccer::Lineup
- Defined in:
- lib/sportradar/api/soccer/lineup.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#jersey ⇒ Object
readonly
Returns the value of attribute jersey.
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
-
#starting_lineup ⇒ Object
readonly
Returns the value of attribute starting_lineup.
-
#substitutes ⇒ Object
readonly
Returns the value of attribute substitutes.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
Instance Method Summary collapse
-
#initialize(data, **opts) ⇒ Lineup
constructor
A new instance of Lineup.
- #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) ⇒ Lineup
Returns a new instance of Lineup.
7 8 9 10 11 12 13 14 15 |
# File 'lib/sportradar/api/soccer/lineup.rb', line 7 def initialize(data, **opts) @response = data @id = data["team"] @starting_hash = {} @subs_hash = {} update(data, **opts) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/soccer/lineup.rb', line 5 def id @id end |
#jersey ⇒ Object (readonly)
Returns the value of attribute jersey.
5 6 7 |
# File 'lib/sportradar/api/soccer/lineup.rb', line 5 def jersey @jersey end |
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
5 6 7 |
# File 'lib/sportradar/api/soccer/lineup.rb', line 5 def manager @manager end |
#starting_lineup ⇒ Object (readonly)
Returns the value of attribute starting_lineup.
5 6 7 |
# File 'lib/sportradar/api/soccer/lineup.rb', line 5 def starting_lineup @starting_lineup end |
#substitutes ⇒ Object (readonly)
Returns the value of attribute substitutes.
5 6 7 |
# File 'lib/sportradar/api/soccer/lineup.rb', line 5 def substitutes @substitutes end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
5 6 7 |
# File 'lib/sportradar/api/soccer/lineup.rb', line 5 def team @team end |
Instance Method Details
#update(data, **opts) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sportradar/api/soccer/lineup.rb', line 16 def update(data, **opts) @team = data['team'] if data['team'] @manager = OpenStruct.new(data['manager']) if data['manager'] @jersey = OpenStruct.new(data['jersey']) if data['jersey'] # @starting_lineup = data['starting_lineup'] if data['starting_lineup'] # @substitutes = data['substitutes'] if data['substitutes'] create_data(@starting_hash, data['starting_lineup'], klass: Player, api: opts[:api], lineup: self) if data['starting_lineup'] create_data(@subs_hash, data['substitutes'], klass: Player, api: opts[:api], lineup: self) if data['substitutes'] end |