Class: Sportradar::Api::Basketball::ShotMade

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

Direct Known Subclasses

FreeThrowMade, ThreePointMade, TwoPointMade

Instance Attribute Summary collapse

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, #display_type, #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 Attribute Details

#assistObject (readonly)

Returns the value of attribute assist.



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

def assist
  @assist
end

#shot_typeObject (readonly)

Returns the value of attribute shot_type.



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

def shot_type
  @shot_type
end

#shot_type_descObject (readonly)

Returns the value of attribute shot_type_desc.



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

def shot_type_desc
  @shot_type_desc
end

Instance Method Details

#base_keyObject



6
7
8
# File 'lib/sportradar/api/basketball/plays/shot_made.rb', line 6

def base_key
  "fieldgoal"
end

#made?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/sportradar/api/basketball/plays/shot_made.rb', line 16

def made?
  true
end

#parse_statistics(data) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/sportradar/api/basketball/plays/shot_made.rb', line 9

def parse_statistics(data)
  super
  stat = @statistics.detect { |hash| hash['type'] == base_key }
  @shot_type = stat['shot_type']
  @shot_type_desc = stat['shot_type_desc']
  @assist = Assist.new(data, quarter: @quarter, half: @half) if @statistics.detect { |hash|  hash['type'] == 'assist' }
end