sportradar-api 0.11.33 → 0.11.34
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sportradar/api/football/ncaafb/drive.rb +1 -3
- data/lib/sportradar/api/football/ncaafb/play.rb +3 -0
- data/lib/sportradar/api/football/play.rb +2 -1
- data/lib/sportradar/api/football/play_statistics.rb +4 -4
- data/lib/sportradar/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfcd28ae63ac6220f6428cf33f57850734914a2d
|
4
|
+
data.tar.gz: 865a1e31fe5bd0a24c09ea2bfa215808a6b85bbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dca061a39c45f60c6133d0c54a72c6297a9ec5c16efe63f41260a8926d24a0ce2fac59ce245a7f86c23ec6ba4c2ae582e0442ec408e26357ba523b49da666069
|
7
|
+
data.tar.gz: 1731810e922e7853af5feb6e6112fcc600c96f64b041c7299b45e826b34c1f9e0aa952dd5fe37a4df8f6e92e0ee97659602ccad18c2944d465fdf702d5c956e5
|
data/Gemfile.lock
CHANGED
@@ -24,9 +24,7 @@ module Sportradar
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def gain
|
27
|
-
Array(plays.select(&:counted_play?)).
|
28
|
-
Array(play.statistics.pass).map(&:yards).inject(:+).to_i + Array(play.statistics.rush).map(&:yards).inject(:+).to_i
|
29
|
-
end
|
27
|
+
Array(plays.select(&:counted_play?)).map(&:yards).inject(:+).to_i
|
30
28
|
end
|
31
29
|
|
32
30
|
end
|
@@ -4,6 +4,9 @@ module Sportradar
|
|
4
4
|
class Ncaafb
|
5
5
|
class Play < Sportradar::Api::Football::Play
|
6
6
|
|
7
|
+
def yards
|
8
|
+
(counted_play? && (statistics.pass&.first || statistics.rush&.first)&.yards).to_i
|
9
|
+
end
|
7
10
|
|
8
11
|
def counted_play?
|
9
12
|
['rush', 'pass'].include?(self.play_type) && !self.description.include?('No Play')
|
@@ -2,7 +2,7 @@ module Sportradar
|
|
2
2
|
module Api
|
3
3
|
module Football
|
4
4
|
class Play < Data
|
5
|
-
attr_accessor :response, :id, :sequence, :reference, :clock, :home_points, :away_points, :type, :play_clock, :wall_clock, :start_situation, :end_situation, :description, :alt_description, :statistics, :score, :scoring_play, :team_id, :player_id, :play_type, :players, :down, :yfd
|
5
|
+
attr_accessor :response, :id, :sequence, :reference, :clock, :home_points, :away_points, :type, :play_clock, :wall_clock, :start_situation, :end_situation, :description, :alt_description, :statistics, :score, :scoring_play, :team_id, :player_id, :play_type, :players, :down, :yfd, :player_data
|
6
6
|
|
7
7
|
def initialize(data, **opts)
|
8
8
|
@response = data
|
@@ -51,6 +51,7 @@ module Sportradar
|
|
51
51
|
if data['statistics']
|
52
52
|
@statistics = Sportradar::Api::Football::PlayStatistics.new(data['statistics'])
|
53
53
|
elsif data['players']
|
54
|
+
@player_data = data['players']
|
54
55
|
@statistics = Sportradar::Api::Football::PlayStatistics.new(data['players'])
|
55
56
|
else
|
56
57
|
@statistics ||= OpenStruct.new(players: [])
|
@@ -8,8 +8,7 @@ module Sportradar
|
|
8
8
|
@response = data
|
9
9
|
if data.first['name'] # indicates college data structures. we want to convert it to nfl data structures
|
10
10
|
data.map! do |hash|
|
11
|
-
type = self.class.college_type_translations.each_key.detect { |str| hash.key?(str) }
|
12
|
-
binding.pry if type.nil?
|
11
|
+
type = self.class.college_type_translations.each_key.detect { |str| hash.key?(str) } || 'misc'
|
13
12
|
stats = hash.delete(type)
|
14
13
|
new_team = { 'id' => hash['team'], 'alias' => hash['team'] } # use intermediate variable to avoid temp memory blowup
|
15
14
|
new_hash = { 'player' => hash, 'team' => new_team, 'stat_type' => self.class.college_type_translations[type] }.merge(stats)
|
@@ -53,6 +52,7 @@ module Sportradar
|
|
53
52
|
"interception_return" => 'return',
|
54
53
|
"fumble_return" => 'return',
|
55
54
|
"punt_return" => 'return',
|
55
|
+
"two_point_conversion" => 'conversion',
|
56
56
|
'misc' => 'misc',
|
57
57
|
}.freeze
|
58
58
|
end
|
@@ -339,8 +339,8 @@ module Sportradar
|
|
339
339
|
def initialize(data)
|
340
340
|
@response = data
|
341
341
|
@stat_type = data['stat_type']
|
342
|
-
@attempt = data['attempt']
|
343
|
-
@complete = data['complete']
|
342
|
+
@attempt = data['attempt'] || data['att']
|
343
|
+
@complete = data['complete'] || data['cmp']
|
344
344
|
@category = data['category']
|
345
345
|
@team = OpenStruct.new(data['team']) if data['team']
|
346
346
|
@player = OpenStruct.new(data['player']) if data['player']
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportradar-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.34
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|