Class: Sportradar::Api::Soccer::Event
- Defined in:
- lib/sportradar/api/soccer/event.rb
Instance Attribute Summary collapse
-
#away_score ⇒ Object
readonly
Returns the value of attribute away_score.
-
#commentaries ⇒ Object
readonly
Returns the value of attribute commentaries.
-
#goal_scorer ⇒ Object
readonly
Returns the value of attribute goal_scorer.
-
#home_score ⇒ Object
readonly
Returns the value of attribute home_score.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#match_time ⇒ Object
readonly
Returns the value of attribute match_time.
-
#outcome ⇒ Object
readonly
Returns the value of attribute outcome.
-
#period ⇒ Object
readonly
Returns the value of attribute period.
-
#period_name ⇒ Object
readonly
Returns the value of attribute period_name.
-
#period_type ⇒ Object
readonly
Returns the value of attribute period_type.
-
#player ⇒ Object
readonly
Returns the value of attribute player.
-
#player_in ⇒ Object
readonly
Returns the value of attribute player_in.
-
#player_out ⇒ Object
readonly
Returns the value of attribute player_out.
-
#stoppage_time ⇒ Object
readonly
Returns the value of attribute stoppage_time.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(data, **opts) ⇒ Event
constructor
A new instance of Event.
- #minute ⇒ Object
- #update(data, **opts) ⇒ Object
- #updated ⇒ 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) ⇒ Event
Returns a new instance of Event.
7 8 9 10 11 12 |
# File 'lib/sportradar/api/soccer/event.rb', line 7 def initialize(data, **opts) @response = data @id = data["id"] update(data, **opts) end |
Instance Attribute Details
#away_score ⇒ Object (readonly)
Returns the value of attribute away_score.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def away_score @away_score end |
#commentaries ⇒ Object (readonly)
Returns the value of attribute commentaries.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def commentaries @commentaries end |
#goal_scorer ⇒ Object (readonly)
Returns the value of attribute goal_scorer.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def goal_scorer @goal_scorer end |
#home_score ⇒ Object (readonly)
Returns the value of attribute home_score.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def home_score @home_score end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def id @id end |
#match_time ⇒ Object (readonly)
Returns the value of attribute match_time.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def match_time @match_time end |
#outcome ⇒ Object (readonly)
Returns the value of attribute outcome.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def outcome @outcome end |
#period ⇒ Object (readonly)
Returns the value of attribute period.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def period @period end |
#period_name ⇒ Object (readonly)
Returns the value of attribute period_name.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def period_name @period_name end |
#period_type ⇒ Object (readonly)
Returns the value of attribute period_type.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def period_type @period_type end |
#player ⇒ Object (readonly)
Returns the value of attribute player.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def player @player end |
#player_in ⇒ Object (readonly)
Returns the value of attribute player_in.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def player_in @player_in end |
#player_out ⇒ Object (readonly)
Returns the value of attribute player_out.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def player_out @player_out end |
#stoppage_time ⇒ Object (readonly)
Returns the value of attribute stoppage_time.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def stoppage_time @stoppage_time end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def team @team end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def time @time end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def type @type end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
5 6 7 |
# File 'lib/sportradar/api/soccer/event.rb', line 5 def y @y end |
Instance Method Details
#minute ⇒ Object
39 40 41 |
# File 'lib/sportradar/api/soccer/event.rb', line 39 def minute @match_time end |
#update(data, **opts) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sportradar/api/soccer/event.rb', line 14 def update(data, **opts) @type = data['type'] if data['type'] @time = Time.parse(data['time']) if data['time'] @period = data['period'] if data['period'] @period_type = data['period_type'] if data['period_type'] @period_name = data['period_name'] if data['period_name'] @match_time = data['match_time'] if data['match_time'] @team = data['team'] if data['team'] @x = data['x'] if data['x'] @y = data['y'] if data['y'] @outcome = data['outcome'] if data['outcome'] @home_score = data['home_score'] if data['home_score'] @away_score = data['away_score'] if data['away_score'] @commentaries = data['commentaries'] if data['commentaries'] @goal_scorer = OpenStruct.new(data['goal_scorer']) if data['goal_scorer'] @stoppage_time = data['stoppage_time'].to_i if data['stoppage_time'] @player_out = OpenStruct.new(data['player_out']) if data['player_out'] @player_in = OpenStruct.new(data['player_in']) if data['player_in'] @player = OpenStruct.new(data['player']) if data['player'] # red/yellow cards end |
#updated ⇒ Object
35 36 37 |
# File 'lib/sportradar/api/soccer/event.rb', line 35 def updated @time end |