sportradar-api 0.11.44 → 0.11.45

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: bcd788689136d0c4a134634e4c7853de9f29d6c9
4
- data.tar.gz: 745710ac565b02ee6cd61076bcda629147460ded
3
+ metadata.gz: 9cc08aa8f7c37e61ffc3d8d0b340123dda451cbe
4
+ data.tar.gz: 46c87305f2d9a2f1cf80de68507bee0276286b8a
5
5
  SHA512:
6
- metadata.gz: 142f9f3cbe7a22bf676aa58907de0c34df73631a08553bfb652712083307e90ccc88cb307c3a628e912012c800d35a9dc50ccfa7fb47986dcb2ee6ff573b26ff
7
- data.tar.gz: 958cf1ee6eb5851e5f5fc4737c601bb98afb38b17ac3eb97d11b62b4b7749bd2fde9411085631b7aaba16620dc333168889b13d5676bfe9b0b2d08c5a5c1bfd9
6
+ metadata.gz: c778032eff44bb6a6926ed66e519b0081f3b2da70bdc97315d5720be313151e347f5ba1bc219780aa28cb8042998e8fafb0c10889785d2a8e44445c13e0678f0
7
+ data.tar.gz: 5e9b76c46c4995e1fcfc3b8f6e705211845103f70f100559bfba1b760e0033c2f49d1fe677ac3fdd61e6cd0b41a1820156311cf1aae06cc4e434f5b8646f0d3f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.11.44)
4
+ sportradar-api (0.11.45)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -15,10 +15,29 @@ module Sportradar
15
15
  }
16
16
  end
17
17
 
18
+ def duration_seconds
19
+ start_time = plays.first&.clock_seconds
20
+ end_time = plays.last&.clock_seconds
21
+ if end_time > start_time
22
+ start_time + 900 - end_time
23
+ else
24
+ start_time - end_time
25
+ end
26
+ end
27
+
28
+ def duration
29
+ mm, ss = duration_seconds.divmod(60)
30
+ "#{mm}:#{ss.to_s.rjust(2, '0')}"
31
+ end
32
+
18
33
  def end_reason
19
34
  plays.last.parsed_ending || 'UNKNOWN'
20
35
  end
21
36
 
37
+ def first_downs
38
+ plays.count(&:made_first_down?)
39
+ end
40
+
22
41
  def over?
23
42
  plays.last&.parsed_ending || (overtime? && ['End of Quarter', 'End of Game'].include?(plays.last&.description))
24
43
  end
@@ -5,15 +5,28 @@ module Sportradar
5
5
  class Play < Sportradar::Api::Football::Play
6
6
 
7
7
  def play_type
8
- if @play_type == 'Kick'
9
- 'Kickoff'
10
- elsif @play_type == 'ExtraPoint'
11
- 'Extra Point'
8
+ if @play_type.nil?
9
+ nil
10
+ elsif @play_type.casecmp? 'kick'
11
+ 'kickoff'
12
+ elsif @play_type.casecmp? 'extrapoint'
13
+ 'extra point'
14
+ elsif @play_type.casecmp? 'fieldgoal'
15
+ 'field goal'
12
16
  else
13
17
  super
14
18
  end
15
19
  end
16
20
 
21
+ def clock_seconds
22
+ m,s = @clock.split(':')
23
+ m.to_i * 60 + s.to_i
24
+ end
25
+
26
+ def made_first_down?
27
+ statistics.pass&.first&.firstdown == 1 || statistics.rush&.first&.firstdown == 1
28
+ end
29
+
17
30
  def yards
18
31
  (counted_play? && (statistics.pass&.first || statistics.rush&.first)&.yards).to_i
19
32
  end
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.11.44"
3
+ VERSION = "0.11.45"
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.44
4
+ version: 0.11.45
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-25 00:00:00.000000000 Z
11
+ date: 2017-08-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler