sportradar-api 0.11.34 → 0.11.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cfcd28ae63ac6220f6428cf33f57850734914a2d
4
- data.tar.gz: 865a1e31fe5bd0a24c09ea2bfa215808a6b85bbf
3
+ metadata.gz: 66e0d9dfe29c0eaabddc956f1de904d51c1addbe
4
+ data.tar.gz: 33d40a64e3bd1e6cb302baa29b326def1eb6bdcc
5
5
  SHA512:
6
- metadata.gz: dca061a39c45f60c6133d0c54a72c6297a9ec5c16efe63f41260a8926d24a0ce2fac59ce245a7f86c23ec6ba4c2ae582e0442ec408e26357ba523b49da666069
7
- data.tar.gz: 1731810e922e7853af5feb6e6112fcc600c96f64b041c7299b45e826b34c1f9e0aa952dd5fe37a4df8f6e92e0ee97659602ccad18c2944d465fdf702d5c956e5
6
+ metadata.gz: b1362b108d7a47ba6542955157903d444a05cd891c4d899fe0f795d515fb7d8c1803018c96a1754395a29352f8aae092e90415ca6b7251da2de38319c3b6212d
7
+ data.tar.gz: 9d06816e9535be9678296110080ab5de723e3114eac0314db22c96fc2e7169c5cef0d116833a0bd68d7344c16003c0fde78d5d74caf1d8cb808bb6df7945ff3b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.11.34)
4
+ sportradar-api (0.11.35)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -25,9 +25,9 @@ module Sportradar
25
25
 
26
26
  def get_details
27
27
  if @details
28
- data = @api.get_data(@details).to_h
29
- update(data)
30
- data
28
+ @detailed_data = @api.get_data(@details).to_h
29
+ update(@detailed_data)
30
+ @detailed_data
31
31
  end
32
32
  end
33
33
 
@@ -64,7 +64,7 @@ module Sportradar
64
64
  when /intercepted/i
65
65
  :interception
66
66
  when /fumbles/i
67
- :fumble
67
+ self.statistics&.fumble&.first&.lost? && :fumble
68
68
  when /extra point is good/i
69
69
  :touchdown
70
70
  # when missed extra point
@@ -124,7 +124,7 @@ module Sportradar
124
124
  when /intercepted/i
125
125
  :interception
126
126
  when /fumbles/i
127
- :fumble
127
+ self.statistics&.fumble&.first&.lost? && :fumble
128
128
  when /extra point is good/i
129
129
  :touchdown
130
130
  # when missed extra point
@@ -2,16 +2,18 @@ module Sportradar
2
2
  module Api
3
3
  module Football
4
4
  class PlayStatistics < Data
5
- attr_accessor :response, :kick, :return, :rush, :defense, :receive, :punt, :penalty, :pass, :first_down, :field_goal, :extra_point, :defense, :down_conversion
5
+ attr_accessor :response, :kick, :return, :rush, :defense, :receive, :punt, :penalty, :pass, :first_down, :field_goal, :extra_point, :defense, :down_conversion, :fumble
6
6
  def initialize(data)
7
7
  data = [data] if data.is_a?(Hash)
8
8
  @response = data
9
9
  if data.first['name'] # indicates college data structures. we want to convert it to nfl data structures
10
- data.map! do |hash|
11
- type = self.class.college_type_translations.each_key.detect { |str| hash.key?(str) } || 'misc'
12
- stats = hash.delete(type)
13
- new_team = { 'id' => hash['team'], 'alias' => hash['team'] } # use intermediate variable to avoid temp memory blowup
14
- new_hash = { 'player' => hash, 'team' => new_team, 'stat_type' => self.class.college_type_translations[type] }.merge(stats)
10
+ data = data.flat_map do |hash|
11
+ types = self.class.college_type_translations.each_key.select { |str| hash.key?(str) }
12
+ types.map do |type|
13
+ stats = hash.delete(type)
14
+ new_team = { 'id' => hash['team'], 'alias' => hash['team'] } # use intermediate variable to avoid temp memory blowup
15
+ { 'player' => hash, 'team' => new_team, 'stat_type' => self.class.college_type_translations[type] }.merge(stats)
16
+ end
15
17
  end
16
18
  end
17
19
  data.each do |hash|
@@ -280,6 +282,8 @@ module Sportradar
280
282
  attr_reader :own_rec, :own_rec_yards, :forced, :team, :player
281
283
  def initialize(data)
282
284
  @response = data
285
+ @oob = data['oob']
286
+ @lost = data['lost']
283
287
  @own_rec = data['own_rec']
284
288
  @own_rec_yards = data['own_rec_yards']
285
289
  @forced = data['forced']
@@ -287,6 +291,9 @@ module Sportradar
287
291
  @team = OpenStruct.new(data['team']) if data['team']
288
292
  @player = OpenStruct.new(data['player']) if data['player']
289
293
  end
294
+ def lost?
295
+ @lost == 1 || @own_rec == 0
296
+ end
290
297
  end
291
298
 
292
299
  class PlayRushStatistics < Data
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.11.34"
3
+ VERSION = "0.11.35"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportradar-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.34
4
+ version: 0.11.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett