lib/sportradar/api/football/stat_pack/penalties.rb in sportradar-api-0.1.38 vs lib/sportradar/api/football/stat_pack/penalties.rb in sportradar-api-0.9.0
- old
+ new
@@ -4,13 +4,14 @@
attr_accessor :penalties, :yards
alias :count :penalties
def set_stats
- @response = response[1] if response.is_a? Array
- @penalties = response['penalties']
- @yards = response['yards']
+ @response = (response.dig(1) || {}) if response.is_a? Array
+ @penalties = response.dig('penalties')
+ @yards = response.dig('yards')
end
+
def formatted
"#{count}-#{yards}"
end
end