sportradar-api 0.11.15 → 0.11.16

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: 63f0b4c345693ed034e2978a954d157263f343aa
4
- data.tar.gz: 2a13a85b7a0e8c9432950a677be065ec68f5d8ad
3
+ metadata.gz: 1e3b4cb30868943236c2f7146156415f0cd11f2b
4
+ data.tar.gz: 6b456bf0c86224e47b2b54eea5676805a8968503
5
5
  SHA512:
6
- metadata.gz: 00f4e2f08e45646ba5090116ccea07d8c218873236c74f522157805049b1faab02ed5217b352b34915b1e1bcc374169de4c8eb078c2dd5fee9c684c49a94fd97
7
- data.tar.gz: 6c139e5511645b391247fe32ef3da6a91248854dad9c20e9a071b879ee84605315650d73f16509584dd5dbea451c5442efd8c9e6dc16bf5f2b96e2201475ccec
6
+ metadata.gz: 32a6b6bd9915bcd7965694822af2cf19ea78350d3a7289636c79bc06c4ad1ad0a6c86869e7013ff3dbd97dd6b933503fb05c9130c9251074eb89ab60392b101a
7
+ data.tar.gz: 3b9f39f440a4e7f690ee89adf5cea73caebccd1f3b016c0a77e92e1aa8d510a0df1d80b63137d02da47c1427637d23a8706c89ae81c5aadb0e640184376e0163
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sportradar-api (0.11.15)
4
+ sportradar-api (0.11.16)
5
5
  activesupport
6
6
  httparty (>= 0.14.0)
7
7
 
@@ -4,6 +4,10 @@ module Sportradar
4
4
  class Ncaafb
5
5
  class Drive < Sportradar::Api::Football::Drive
6
6
 
7
+ def over?
8
+ plays.last&.parsed_ending
9
+ end
10
+
7
11
  def handle_plays_and_events(data, **opts)
8
12
  create_data(@plays_hash, data['actions'], klass: Play, api: api, game: self) if data['actions']
9
13
  create_data(@events_hash, data['events'], klass: Event, api: api, game: self) if data['events']
@@ -9,12 +9,30 @@ module Sportradar
9
9
  @parsed_ending ||= parse_description_for_drive_end
10
10
  end
11
11
 
12
+
13
+ def queue_details
14
+ if @details
15
+ url, headers, options, timeout = @api.get_request_info(@details)
16
+ {url: url, headers: headers, params: options, timeout: timeout, callback: method(:update)}
17
+ end
18
+ end
19
+
20
+ def get_details
21
+ if @details
22
+ data = @api.get_data(@details).to_h
23
+ update(data)
24
+ data
25
+ end
26
+ end
27
+
12
28
  private
13
29
 
14
30
  def parse_description_for_drive_end
15
31
  parsed_ending = case @description
16
32
  when /intercepted/i
17
33
  :interception
34
+ when /fumbles/i
35
+ :fumble
18
36
  when /extra point is good/i
19
37
  :touchdown
20
38
  # when missed extra point
@@ -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
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
6
6
 
7
7
  def initialize(data, **opts)
8
8
  @response = data
@@ -12,8 +12,10 @@ module Sportradar
12
12
  end
13
13
 
14
14
  def update(data, **opts)
15
- @description = data["description"] || data['summary'] || @description
16
- @alt_description = data['alt_description'] if data['alt_description']
15
+ @api = opts[:api] || @api
16
+ @drive = opts[:drive] || @drive
17
+ @description = data["description"] || data['summary'] || @description
18
+ @alt_description = data['alt_description'] if data['alt_description']
17
19
  @away_points = data['away_points'] if data['away_points']
18
20
  @home_points = data['home_points'] if data['home_points']
19
21
 
@@ -39,10 +41,10 @@ module Sportradar
39
41
  @direction = data["direction"] if data["direction"]
40
42
  @distance = data["distance"] if data["distance"]
41
43
  @participants = data["participants"] if data["participants"]
42
- @details = data["details"] if data["details"]
43
44
  @play_type = data["play_type"] if data["play_type"]
44
45
  @sequence = data["sequence"] if data["sequence"]
45
46
 
47
+ @details = data["details"].gsub('.json', '') if data["details"]
46
48
 
47
49
  # @statistics = Sportradar::Api::Nfl::PlayStatistics.new data["statistics"] if data["statistics"]
48
50
  # parse_player if @statistics
@@ -10,8 +10,12 @@ module Sportradar
10
10
  @down = data["down"]
11
11
  @yfd = data["yfd"]
12
12
  @possession = OpenStruct.new(data["possession"]) if data["possession"]
13
- @location = OpenStruct.new(data["location"]) if data["location"]
14
- @team_id = possession.id if possession
13
+ if data["location"]
14
+ @location = OpenStruct.new(data["location"])
15
+ elsif data['side'] && data['yard_line']
16
+ @location = OpenStruct.new(alias: data['side'], yardline: data['yard_line'])
17
+ end
18
+ @team_id = possession&.id || data["team"]
15
19
  end
16
20
 
17
21
  end
@@ -1,5 +1,5 @@
1
1
  module Sportradar
2
2
  module Api
3
- VERSION = "0.11.15"
3
+ VERSION = "0.11.16"
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.15
4
+ version: 0.11.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett