sportradar-api 0.11.46 → 0.11.47

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: 6f70970e3d92fe1a79b85ea05628b14dc65f44fc
4
- data.tar.gz: b2a8e4b0cc4e3129774d206edeb5290c6b686d60
3
+ metadata.gz: 698896994c87222fe5a5af71b75a65fc721e5718
4
+ data.tar.gz: 2eae0ef96ab1341c07086fabfb0d3a4a86693dea
5
5
  SHA512:
6
- metadata.gz: 61c532b464a0fe2a49864d7892cfa3a3ced0b49080b8464618ccc6b17532af6645426e5157991cd5ec32f91fe931fdfdbe3bd70b9bd663f5b9bf2b28e3f2ddad
7
- data.tar.gz: 815a6be1e5439b92ba640b5c814940352c11c2ce4b760e2fc2ea7ccc13c07df963a5652f9f789a1d0a38edccff870d7fa592dc45687b9c028ae9a9eee900cb84
6
+ metadata.gz: '0186cf996ac7766b68bb2c9fd6e36bbbe8de28385cf2cabc1cb5dd6efd4784aedff789c4126eb64841dabb4c7aeb7c26720d3076865a57bb32aa013ec2f22edf'
7
+ data.tar.gz: f31d333e656224ab5920c4ab2f7a11667e84c93449fdc8485bed5e0e045150dffae5c8796c3d82df8cf33f1bcea8334784b84c19867aecf92ccf9fd73fe45796
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.11.46)
4
+ sportradar-api (0.11.47)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -31,7 +31,7 @@ module Sportradar
31
31
  end
32
32
 
33
33
  def end_reason
34
- plays.last.parsed_ending || 'UNKNOWN'
34
+ plays.reverse_each.detect {|pl| !pl.timeout? && pl.play_type != 'penalty' }&.parsed_ending || 'UNKNOWN' # penalty on TD play, assessed on kickoff
35
35
  end
36
36
 
37
37
  def first_downs
@@ -39,7 +39,7 @@ module Sportradar
39
39
  end
40
40
 
41
41
  def over?
42
- plays.last&.parsed_ending || (overtime? && ['End of Quarter', 'End of Game'].include?(plays.last&.description))
42
+ (end_reason != 'UNKNOWN') || (overtime? && ['End of Quarter', 'End of Game'].include?(plays.last&.description))
43
43
  end
44
44
 
45
45
  def handle_plays_and_events(data, **opts)
@@ -7,6 +7,8 @@ module Sportradar
7
7
  def play_type
8
8
  if @play_type.nil?
9
9
  nil
10
+ elsif self.timeout?
11
+ 'timeout'
10
12
  elsif @play_type.casecmp? 'kick'
11
13
  'kickoff'
12
14
  elsif @play_type.casecmp? 'extrapoint'
@@ -35,6 +37,14 @@ module Sportradar
35
37
  ['rush', 'pass'].include?(self.play_type) && !self.description.include?('No Play')
36
38
  end
37
39
 
40
+ def play?
41
+ @event_type.nil?
42
+ end
43
+
44
+ def event?
45
+ !play?
46
+ end
47
+
38
48
  def halftime?
39
49
  @description == "End of 1st Half"
40
50
  end
@@ -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, :player_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, :player_data, :event_type
6
6
 
7
7
  def initialize(data, **opts)
8
8
  @response = data
@@ -22,7 +22,7 @@ module Sportradar
22
22
  @end_situation = Sportradar::Api::Football::Situation.new(data["end_situation"]) if data["end_situation"]
23
23
  @start_situation = Sportradar::Api::Football::Situation.new(data["start_situation"]) if data["start_situation"]
24
24
 
25
- @team_id = end_situation.team_id if end_situation
25
+ @team_id = start_situation.team_id if start_situation
26
26
  @play_clock = data["play_clock"]
27
27
  @reference = data["reference"]
28
28
  @score = data["score"]
@@ -41,8 +41,9 @@ module Sportradar
41
41
  @direction = data["direction"] if data["direction"]
42
42
  @distance = data["distance"] if data["distance"]
43
43
  @participants = data["participants"] if data["participants"]
44
- @play_type = data["play_type"] if data["play_type"]
44
+ @play_type = data["play_type"] || @play_type || data["event_type"]
45
45
  @sequence = data["sequence"] if data["sequence"]
46
+ @event_type = data["event_type"] if data["event_type"]
46
47
 
47
48
  @deleted = data["deleted"] || @deleted
48
49
 
@@ -86,8 +87,12 @@ module Sportradar
86
87
  false
87
88
  end
88
89
 
90
+ def timeout?
91
+ ['timeout', 'tvtimeout', 'teamtimeout'].include? @play_type
92
+ end
93
+
89
94
  def halftime?
90
- false
95
+ @description == "End of 1st Half"
91
96
  end
92
97
 
93
98
  def parsed_ending
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.11.46"
3
+ VERSION = "0.11.47"
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.46
4
+ version: 0.11.47
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-26 00:00:00.000000000 Z
11
+ date: 2017-08-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler