sportradar-api 0.19.0 → 0.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sportradar/api/football/stats_shim.rb +24 -0
- data/lib/sportradar/api/odds/README.md +1 -1
- data/lib/sportradar/api/odds/base.rb +18 -2
- data/lib/sportradar/api/odds/competition.rb +12 -4
- data/lib/sportradar/api/request.rb +2 -2
- data/lib/sportradar/api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ab01ced5f53daf0d2c078827a4810a4a844713f48efd7cb0f4b7301a760e7a5
|
|
4
|
+
data.tar.gz: 60ee22bcf8fdc96b1ed1083c9cddf1eb904a4e8a985840c36fd105083cc9b7d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f35b85cc02002e09dbb367b5e5bf39ec272a8633c4d2736dbef5f2657ffcd91a3d01d68bce59f052302c8d346a8e75076960db3dd88ae6ba1c64758378fcb69d
|
|
7
|
+
data.tar.gz: 9898e8d1934b86f03e416c90c84f122c3017a1e6e23bc1a87f3c46375774ad4b7eb8dd86a6910be40e6a328385da3a091dac48221ca76b8bb79475892fde3948
|
data/Gemfile.lock
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
module Sportradar
|
|
2
|
+
module Api
|
|
3
|
+
module Football
|
|
4
|
+
class StatsShim
|
|
5
|
+
attr_reader :game
|
|
6
|
+
|
|
7
|
+
def initialize(game)
|
|
8
|
+
@game = game
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def dig(player_id, category, stat)
|
|
12
|
+
game.team_stats.each_value do |stats|
|
|
13
|
+
player = stats.public_send(category).for_player(player_id)
|
|
14
|
+
if player
|
|
15
|
+
return player.send(stat)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
0
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
@@ -13,7 +13,7 @@ sport.get_competitions
|
|
|
13
13
|
comp = sport.competitions.first
|
|
14
14
|
|
|
15
15
|
api = Sportradar::Api::Odds::PlayerOdds.api
|
|
16
|
-
comp = Sportradar::Api::Odds::Competition.new({'id' => 'sr:competition:
|
|
16
|
+
comp = Sportradar::Api::Odds::Competition.new({'id' => 'sr:competition:109'}, api: api)
|
|
17
17
|
data = comp.get_player_props
|
|
18
18
|
comp.sport_events
|
|
19
19
|
event = comp.sport_events.first
|
|
@@ -31,11 +31,27 @@ module Sportradar
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def get_event_mappings
|
|
34
|
-
data = api.get_data(path_event_mappings)
|
|
34
|
+
data = api.get_data(path_event_mappings).fetch('mappings', [])
|
|
35
|
+
if data.size == 1000
|
|
36
|
+
new_data = data
|
|
37
|
+
while new_data.size == 1000
|
|
38
|
+
new_data = api.get_data(path_player_mappings, start: data.size).fetch('mappings', [])
|
|
39
|
+
data += new_data
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
{'mappings' => data }
|
|
35
43
|
end
|
|
36
44
|
|
|
37
45
|
def get_player_mappings
|
|
38
|
-
data = api.get_data(path_player_mappings)
|
|
46
|
+
data = api.get_data(path_player_mappings).fetch('mappings', [])
|
|
47
|
+
if data.size == 1000
|
|
48
|
+
new_data = data
|
|
49
|
+
while new_data.size == 1000
|
|
50
|
+
new_data = api.get_data(path_player_mappings, start: data.size).fetch('mappings', [])
|
|
51
|
+
data += new_data
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
{'mappings' => data }
|
|
39
55
|
end
|
|
40
56
|
|
|
41
57
|
def get_competitor_mappings
|
|
@@ -28,13 +28,21 @@ module Sportradar
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def get_player_props
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
prop_data = fetch_player_props.fetch('competition_sport_events_players_props', [])
|
|
32
|
+
if prop_data.size == 10
|
|
33
|
+
new_data = prop_data
|
|
34
|
+
while new_data.size == 10
|
|
35
|
+
new_data = fetch_player_props(start: prop_data.size).fetch('competition_sport_events_players_props', [])
|
|
36
|
+
prop_data += new_data
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
data = {'competition_sport_events_players_props' => prop_data }
|
|
40
|
+
create_data(@sport_events_hash, prop_data, klass: SportEvent, api: api)
|
|
33
41
|
data
|
|
34
42
|
end
|
|
35
43
|
|
|
36
|
-
def fetch_player_props
|
|
37
|
-
api.get_data(path_player_props)
|
|
44
|
+
def fetch_player_props(params = {})
|
|
45
|
+
api.get_data(path_player_props, params)
|
|
38
46
|
end
|
|
39
47
|
|
|
40
48
|
# url path helpers
|
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.19.
|
|
4
|
+
version: 0.19.3
|
|
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-07-
|
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -380,6 +380,7 @@ files:
|
|
|
380
380
|
- lib/sportradar/api/football/stat_pack/punts.rb
|
|
381
381
|
- lib/sportradar/api/football/stat_pack/receiving.rb
|
|
382
382
|
- lib/sportradar/api/football/stat_pack/rushing.rb
|
|
383
|
+
- lib/sportradar/api/football/stats_shim.rb
|
|
383
384
|
- lib/sportradar/api/football/team.rb
|
|
384
385
|
- lib/sportradar/api/football/venue.rb
|
|
385
386
|
- lib/sportradar/api/football/week.rb
|