Class: Sportradar::Api::Football::StatPack::Penalties

Inherits:
Sportradar::Api::Football::StatPack show all
Defined in:
lib/sportradar/api/football/stat_pack/penalties.rb

Instance Attribute Summary collapse

Attributes inherited from Sportradar::Api::Football::StatPack

#id, #name, #player, #players, #position, #response

Instance Method Summary collapse

Methods inherited from Sportradar::Api::Football::StatPack

#initialize

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::Football::StatPack

Instance Attribute Details

#penaltiesObject Also known as: count

Returns the value of attribute penalties.



4
5
6
# File 'lib/sportradar/api/football/stat_pack/penalties.rb', line 4

def penalties
  @penalties
end

#yardsObject

Returns the value of attribute yards.



4
5
6
# File 'lib/sportradar/api/football/stat_pack/penalties.rb', line 4

def yards
  @yards
end

Instance Method Details

#formattedObject



14
15
16
# File 'lib/sportradar/api/football/stat_pack/penalties.rb', line 14

def formatted
  "#{count}-#{yards}"
end

#set_statsObject



8
9
10
11
12
# File 'lib/sportradar/api/football/stat_pack/penalties.rb', line 8

def set_stats
  @response  = (response.dig(1) || {}) if response.is_a? Array
  @penalties = response.dig('penalties') || response['num']
  @yards     = response.dig('yards') || response['yds']
end