Class: Sportradar::Api::Football::PlayPenaltyStatistics

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

Returns a new instance of PlayPenaltyStatistics.



234
235
236
237
238
239
240
241
242
# File 'lib/sportradar/api/football/play_statistics.rb', line 234

def initialize(data)
  @response = data
  @penalty    = data['penalty'] || data['abbr'] # unsure about abbr here
  @yards      = data['yards']   || data['yds']
  @first_down = data['fd']
  @team       = OpenStruct.new(data['team']) if data['team']
  @player     = OpenStruct.new(data['player']) if data['player']
  @nullified  = data['nullified']
end

Instance Attribute Details

#first_downObject

Returns the value of attribute first_down.



233
234
235
# File 'lib/sportradar/api/football/play_statistics.rb', line 233

def first_down
  @first_down
end

#nullifiedObject

Returns the value of attribute nullified.



233
234
235
# File 'lib/sportradar/api/football/play_statistics.rb', line 233

def nullified
  @nullified
end

#penaltyObject

Returns the value of attribute penalty.



233
234
235
# File 'lib/sportradar/api/football/play_statistics.rb', line 233

def penalty
  @penalty
end

#playerObject

Returns the value of attribute player.



233
234
235
# File 'lib/sportradar/api/football/play_statistics.rb', line 233

def player
  @player
end

#teamObject

Returns the value of attribute team.



233
234
235
# File 'lib/sportradar/api/football/play_statistics.rb', line 233

def team
  @team
end

#yardsObject

Returns the value of attribute yards.



233
234
235
# File 'lib/sportradar/api/football/play_statistics.rb', line 233

def yards
  @yards
end

Instance Method Details

#nullified?Boolean

Returns:

  • (Boolean)


244
245
246
# File 'lib/sportradar/api/football/play_statistics.rb', line 244

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