Class: Sportradar::Nhl::Models::Period
- Inherits:
-
Object
- Object
- Sportradar::Nhl::Models::Period
- Defined in:
- lib/sportradar/nhl/models/period.rb
Instance Method Summary collapse
- #abbreviation ⇒ Object
- #events ⇒ Object
- #events_data ⇒ Object
- #game_id ⇒ Object
- #id ⇒ Object
-
#initialize(game_id:, attributes:) ⇒ Period
constructor
A new instance of Period.
- #number ⇒ Object
- #penalties ⇒ Object
- #plays ⇒ Object
- #scoring_plays ⇒ Object
- #stoppages ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(game_id:, attributes:) ⇒ Period
Returns a new instance of Period.
5 6 7 8 9 |
# File 'lib/sportradar/nhl/models/period.rb', line 5 def initialize(game_id:, attributes:) @game_id = game_id @attributes = attributes build_events end |
Instance Method Details
#abbreviation ⇒ Object
15 16 17 |
# File 'lib/sportradar/nhl/models/period.rb', line 15 def abbreviation "#{number}" end |
#events ⇒ Object
31 32 33 |
# File 'lib/sportradar/nhl/models/period.rb', line 31 def events @events ||= [] end |
#events_data ⇒ Object
35 36 37 |
# File 'lib/sportradar/nhl/models/period.rb', line 35 def events_data @actions ||= @attributes.dig('events') || [] end |
#game_id ⇒ Object
19 20 21 |
# File 'lib/sportradar/nhl/models/period.rb', line 19 def game_id @game_id end |
#id ⇒ Object
23 24 25 |
# File 'lib/sportradar/nhl/models/period.rb', line 23 def id @id end |
#number ⇒ Object
27 28 29 |
# File 'lib/sportradar/nhl/models/period.rb', line 27 def number @attributes['number'] || 0 end |
#penalties ⇒ Object
39 40 41 |
# File 'lib/sportradar/nhl/models/period.rb', line 39 def penalties @penalties ||= [] end |
#plays ⇒ Object
43 44 45 |
# File 'lib/sportradar/nhl/models/period.rb', line 43 def plays @plays ||= [] end |
#scoring_plays ⇒ Object
47 48 49 |
# File 'lib/sportradar/nhl/models/period.rb', line 47 def scoring_plays @scoring_plays ||= [] end |
#stoppages ⇒ Object
51 52 53 |
# File 'lib/sportradar/nhl/models/period.rb', line 51 def stoppages @stoppages ||= [] end |
#to_s ⇒ Object
11 12 13 |
# File 'lib/sportradar/nhl/models/period.rb', line 11 def to_s "Period #{number}" end |