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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d83f297a9f5ffdb07d5b22b82b3ffa2acca6c1d4
4
- data.tar.gz: b7dd7428c3ad7033b55ac750bebd6874e45da6e8
3
+ metadata.gz: cfcd28ae63ac6220f6428cf33f57850734914a2d
4
+ data.tar.gz: 865a1e31fe5bd0a24c09ea2bfa215808a6b85bbf
5
5
  SHA512:
6
- metadata.gz: 9c68f020e5dbdc8f8ec9eaf27cdfbc82781f139e8864c54f8be80d10aa1535146b50ba10c82bac1fd473783c7a05d92d086a2b822736a89e483b777af5e79e8a
7
- data.tar.gz: eaab1b089f36c74180851f631c4987e9824f01a6dabdbdffe83d078278f0cc6567d0873c21f11a978cb78f1c7daa726b083aa58b9e235f9c76dde02c3808854f
6
+ metadata.gz: dca061a39c45f60c6133d0c54a72c6297a9ec5c16efe63f41260a8926d24a0ce2fac59ce245a7f86c23ec6ba4c2ae582e0442ec408e26357ba523b49da666069
7
+ data.tar.gz: 1731810e922e7853af5feb6e6112fcc600c96f64b041c7299b45e826b34c1f9e0aa952dd5fe37a4df8f6e92e0ee97659602ccad18c2944d465fdf702d5c956e5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.11.33)
4
+ sportradar-api (0.11.34)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -24,9 +24,7 @@ module Sportradar
24
24
  end
25
25
 
26
26
  def gain
27
- Array(plays.select(&:counted_play?)).sum do |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']
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.11.33"
3
+ VERSION = "0.11.34"
4
4
  end
5
5
  end
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.33
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-24 00:00:00.000000000 Z
11
+ date: 2017-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler