Class: Sportradar::Api::Football::PlayFieldGoalStatistics

Inherits:
Data
  • Object
show all
Defined in:
lib/sportradar/api/football/play_statistics.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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) ⇒ PlayFieldGoalStatistics

Returns a new instance of PlayFieldGoalStatistics.



164
165
166
167
168
169
170
171
172
173
174
# File 'lib/sportradar/api/football/play_statistics.rb', line 164

def initialize(data)
  @response = data
  @attempt    = data['attempt']   || data['att']
  @att_yards  = data['att_yards']
  @blocked    = data['blocked']   || data['blk']
  @missed     = data['missed']
  @yards      = data['yards']     || data['yds']
  @nullified  = data['nullified']
  @team       = OpenStruct.new(data['team']) if data['team']
  @player     = OpenStruct.new(data['player']) if data['player']
end

Instance Attribute Details

#att_yardsObject

Returns the value of attribute att_yards.



163
164
165
# File 'lib/sportradar/api/football/play_statistics.rb', line 163

def att_yards
  @att_yards
end

#attemptObject

Returns the value of attribute attempt.



163
164
165
# File 'lib/sportradar/api/football/play_statistics.rb', line 163

def attempt
  @attempt
end

#blockedObject

Returns the value of attribute blocked.



163
164
165
# File 'lib/sportradar/api/football/play_statistics.rb', line 163

def blocked
  @blocked
end

#missedObject

Returns the value of attribute missed.



163
164
165
# File 'lib/sportradar/api/football/play_statistics.rb', line 163

def missed
  @missed
end

#nullifiedObject

Returns the value of attribute nullified.



163
164
165
# File 'lib/sportradar/api/football/play_statistics.rb', line 163

def nullified
  @nullified
end

#playerObject

Returns the value of attribute player.



163
164
165
# File 'lib/sportradar/api/football/play_statistics.rb', line 163

def player
  @player
end

#teamObject

Returns the value of attribute team.



163
164
165
# File 'lib/sportradar/api/football/play_statistics.rb', line 163

def team
  @team
end

#yardsObject

Returns the value of attribute yards.



163
164
165
# File 'lib/sportradar/api/football/play_statistics.rb', line 163

def yards
  @yards
end

Instance Method Details

#made?Boolean

Returns:

  • (Boolean)


176
177
178
# File 'lib/sportradar/api/football/play_statistics.rb', line 176

def made?
  !missed? && !nullified?
end

#missed?Boolean

Returns:

  • (Boolean)


180
181
182
# File 'lib/sportradar/api/football/play_statistics.rb', line 180

def missed?
  @missed == 1 || @blocked == 1
end

#nullified?Boolean

Returns:

  • (Boolean)


184
185
186
# File 'lib/sportradar/api/football/play_statistics.rb', line 184

def nullified?
  @nullified.to_s == 'true'
end