Class: Sportradar::Api::Basketball::Rebound

Inherits:
Play::Base show all
Defined in:
lib/sportradar/api/basketball/plays/rebound.rb

Instance Attribute Summary

Attributes inherited from Play::Base

#clock, #description, #event_type, #game_seconds, #half, #id, #identifier, #location, #on_court, #on_court_ids, #player_id, #possession, #quarter, #response, #score, #statistics, #team_id, #updated

Instance Method Summary collapse

Methods inherited from Play::Base

#==, #clock_seconds, #end_of_ot?, #end_of_period?, #end_of_regulation?, #halftime?, #handle_on_court, #handle_time, #initialize, #media_timeout?, #nba_game_seconds, #period, #points, #quarter_break?, #scoring_play?, #timeout?, #update

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

This class inherits a constructor from Sportradar::Api::Basketball::Play::Base

Instance Method Details

#base_keyObject



5
6
7
# File 'lib/sportradar/api/basketball/plays/rebound.rb', line 5

def base_key
  'rebound'
end

#defensive?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/sportradar/api/basketball/plays/rebound.rb', line 11

def defensive?
  @rebound_type == 'defensive'
end

#display_typeObject



8
9
10
# File 'lib/sportradar/api/basketball/plays/rebound.rb', line 8

def display_type
  'Rebound'
end

#offensive?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/sportradar/api/basketball/plays/rebound.rb', line 14

def offensive?
  @rebound_type == 'offensive'
end

#parse_statistics(data) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/sportradar/api/basketball/plays/rebound.rb', line 17

def parse_statistics(data)
  super
  stat = @statistics.dig(base_key)
  stat = stat[0] if stat.is_a?(Array)
  @rebound_type = stat['rebound_type']
rescue => e
  # noop => bad data from SR
end