sportradar-api 0.18.1 → 0.19.0
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/game.rb +5 -1
- data/lib/sportradar/api/football/game_stats.rb +4 -0
- data/lib/sportradar/api/football/nfl/api.rb +5 -5
- data/lib/sportradar/api/football/nfl.rb +14 -4
- data/lib/sportradar/api/football/stat_pack.rb +4 -0
- data/lib/sportradar/api/football.rb +1 -0
- data/lib/sportradar/api/odds/sport_event.rb +0 -2
- data/lib/sportradar/api/version.rb +1 -1
- data/lib/sportradar/api.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dc7fd8b3ea2527e80d2450060864338619def6cefdfc95a9bc9dcf1a4f9b52b
|
4
|
+
data.tar.gz: 9ef4960b1876828a908f89e48974ba72e69460094b4b763463fc23e0cb5fb538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593bbf87290172584b6ae110f8e06576ea5d44eee653d02b78d2810f4598fec2da9f9b2506ddc40811a3effefc8190080476b2d8a7febbf908724a2e46cdd20a
|
7
|
+
data.tar.gz: bf275cbedcf92089994c9882903780882dee634f65e7abe0fd0a3f1f0b85052f6d9efec0d07761acb460c750a7d36f1c76f6096f261f10821c1b8c5913de3523
|
data/Gemfile.lock
CHANGED
@@ -20,7 +20,7 @@ module Sportradar
|
|
20
20
|
|
21
21
|
@teams_hash = {}
|
22
22
|
@team_stats = {}
|
23
|
-
@player_stats =
|
23
|
+
@player_stats = StatsShim.new(self)
|
24
24
|
|
25
25
|
@quarters_hash = {}
|
26
26
|
@drives_hash = {}
|
@@ -394,6 +394,10 @@ module Sportradar
|
|
394
394
|
ingest_statistics(data)
|
395
395
|
end
|
396
396
|
|
397
|
+
def get_summary
|
398
|
+
get_statistics
|
399
|
+
end
|
400
|
+
|
397
401
|
def queue_statistics
|
398
402
|
url, headers, options, timeout = api.get_request_info(path_statistics)
|
399
403
|
{url: url, headers: headers, params: options, timeout: timeout, callback: method(:ingest_statistics)}
|
@@ -29,6 +29,10 @@ module Sportradar
|
|
29
29
|
@return_yards = data.dig('summary', "return_yards")
|
30
30
|
end
|
31
31
|
|
32
|
+
def dig(*args)
|
33
|
+
args.inject(self) { |memo, arg| memo.public_send(arg) }
|
34
|
+
end
|
35
|
+
|
32
36
|
def turnovers
|
33
37
|
@turnovers || passing.interceptions + fumbles&.lost_fumbles.to_i
|
34
38
|
end
|
@@ -22,9 +22,9 @@ module Sportradar
|
|
22
22
|
end
|
23
23
|
def default_access_level
|
24
24
|
if (ENV['SPORTRADAR_ENV'] || ENV['SPORTRADAR_ENV_NFL'] || ENV['RACK_ENV'] || ENV['RAILS_ENV']) == 'production'
|
25
|
-
'
|
25
|
+
'production'
|
26
26
|
else
|
27
|
-
'
|
27
|
+
'trial'
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
@@ -35,11 +35,11 @@ module Sportradar
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def request_url(path)
|
38
|
-
"/nfl
|
38
|
+
"/nfl/official/#{access_level}/v#{version}/en/#{path}"
|
39
39
|
end
|
40
40
|
|
41
41
|
def api_key
|
42
|
-
if !['
|
42
|
+
if !['trial', 'sim'].include?(access_level) || (access_level == 'sim' && default_access_level == 'production')
|
43
43
|
::Sportradar::Api.api_key_params('nfl', 'production')
|
44
44
|
else
|
45
45
|
::Sportradar::Api.api_key_params('nfl')
|
@@ -51,7 +51,7 @@ module Sportradar
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def allowed_access_levels
|
54
|
-
%w[
|
54
|
+
%w[production trial sim]
|
55
55
|
end
|
56
56
|
|
57
57
|
def allowed_seasons
|
@@ -159,13 +159,13 @@ module Sportradar
|
|
159
159
|
"games/#{season_year}/#{nfl_season}/#{nfl_season_week}/schedule"
|
160
160
|
end
|
161
161
|
def path_weekly_depth_charts(nfl_season_week)
|
162
|
-
"
|
162
|
+
"seasons/#{season_year}/#{nfl_season}/#{nfl_season_week}/depth_charts"
|
163
163
|
end
|
164
164
|
def path_weekly_depth_injuries(nfl_season_week)
|
165
|
-
"
|
165
|
+
"seasons/#{season_year}/#{nfl_season}/#{nfl_season_week}/injuries"
|
166
166
|
end
|
167
167
|
def path_standings
|
168
|
-
"
|
168
|
+
"seasons/#{season_year}/standings"
|
169
169
|
end
|
170
170
|
|
171
171
|
# data retrieval
|
@@ -320,4 +320,14 @@ File.binwrite('nfl.bin', Marshal.dump(nfl))
|
|
320
320
|
nfl = Sportradar::Api::Football::Nfl.new
|
321
321
|
nfl.season = 2016
|
322
322
|
res = nfl.get_weekly_depth_charts
|
323
|
-
dc = nfl.instance_variable_get(:@depth_charts_hash)
|
323
|
+
dc = nfl.instance_variable_get(:@depth_charts_hash)
|
324
|
+
|
325
|
+
|
326
|
+
nfl = Sportradar::Api::Football::Nfl.new
|
327
|
+
nfl.season = 2021
|
328
|
+
nfl.get_schedule
|
329
|
+
g = nfl.games.sample
|
330
|
+
data = g.get_statistics
|
331
|
+
g.team_stats
|
332
|
+
g.team_stats.values.first.dig('rushing', 'yards')
|
333
|
+
|
@@ -30,8 +30,6 @@ module Sportradar
|
|
30
30
|
def update(data, **opts)
|
31
31
|
create_data(@player_props_hash, data['players_props'], klass: PlayerProp, api: api) if data['players_props']
|
32
32
|
create_data(@player_markets_hash, data['players_markets'], klass: Market, api: api) if data['players_markets']
|
33
|
-
rescue => e
|
34
|
-
binding.pry
|
35
33
|
end
|
36
34
|
|
37
35
|
end
|
data/lib/sportradar/api.rb
CHANGED
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.
|
4
|
+
version: 0.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06
|
11
|
+
date: 2022-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|