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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sportradar/api/football/ncaafb/drive.rb +4 -0
- data/lib/sportradar/api/football/ncaafb/play.rb +18 -0
- data/lib/sportradar/api/football/play.rb +6 -4
- data/lib/sportradar/api/football/situation.rb +6 -2
- data/lib/sportradar/api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e3b4cb30868943236c2f7146156415f0cd11f2b
|
4
|
+
data.tar.gz: 6b456bf0c86224e47b2b54eea5676805a8968503
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a6b6bd9915bcd7965694822af2cf19ea78350d3a7289636c79bc06c4ad1ad0a6c86869e7013ff3dbd97dd6b933503fb05c9130c9251074eb89ab60392b101a
|
7
|
+
data.tar.gz: 3b9f39f440a4e7f690ee89adf5cea73caebccd1f3b016c0a77e92e1aa8d510a0df1d80b63137d02da47c1427637d23a8706c89ae81c5aadb0e640184376e0163
|
data/Gemfile.lock
CHANGED
@@ -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
|
-
@
|
16
|
-
@
|
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
|
-
|
14
|
-
|
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
|