sports_data_api 0.14.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ http_interactions:
12
12
  Accept-Encoding:
13
13
  - gzip, deflate
14
14
  User-Agent:
15
- - rest-client/2.0.2 (darwin17.3.0 x86_64) ruby/2.5.0p0
15
+ - rest-client/2.0.2 (darwin16.7.0 x86_64) ruby/2.3.3p222
16
16
  Host:
17
17
  - api.sportradar.us
18
18
  response:
@@ -25,26 +25,25 @@ http_interactions:
25
25
  Age:
26
26
  - '0'
27
27
  Cache-Control:
28
- - public, must-revalidate, max-age=11
28
+ - public,must-revalidate,max-age=1
29
29
  Content-Language:
30
30
  - en
31
31
  Content-Type:
32
32
  - application/json;charset=utf-8
33
33
  Date:
34
- - Wed, 10 Jan 2018 19:19:47 GMT
34
+ - Thu, 31 May 2018 20:59:05 GMT
35
35
  Expires:
36
- - Wed, 10 Jan 2018 19:19:58 GMT
36
+ - Thu, 31 May 2018 20:59:16 GMT
37
37
  Server:
38
38
  - nginx
39
39
  Via:
40
40
  - 1.1 varnish-v4
41
- - 1.1 varnish-v4
42
41
  X-Be-Cache:
43
42
  - MISS
44
43
  X-Fe-Cache:
45
44
  - MISS
46
45
  X-Mashery-Responder:
47
- - prod-j-worker-us-east-1b-127.mashery.com
46
+ - prod-j-worker-us-east-1e-69.mashery.com
48
47
  X-Plan-Qps-Allotted:
49
48
  - '25'
50
49
  X-Plan-Qps-Current:
@@ -52,10 +51,9 @@ http_interactions:
52
51
  X-Plan-Quota-Allotted:
53
52
  - '15000'
54
53
  X-Plan-Quota-Current:
55
- - '54'
54
+ - '36'
56
55
  X-Varnish:
57
- - '22977395'
58
- - '47486214'
56
+ - '1237098'
59
57
  X-Via:
60
58
  - Translation-Proxy
61
59
  Content-Length:
@@ -209,44 +207,5 @@ http_interactions:
209
207
  MDkxYy0wZjI0LTExZTItODUyNS0xOGE5MDU3NjdlNDQiLCJuYW1lIjoiTWlu
210
208
  bmVzb3RhIFdpbGQiLCJhbGlhcyI6Ik1JTiJ9fV19
211
209
  http_version:
212
- recorded_at: Wed, 10 Jan 2018 19:19:47 GMT
213
- - request:
214
- method: get
215
- uri: https://api.sportradar.us/nhl/ot/v5/en/games/2013/12/12/schedule.json?api_key=<API_KEY>
216
- body:
217
- encoding: US-ASCII
218
- base64_string: ''
219
- headers:
220
- Accept:
221
- - "*/*"
222
- Accept-Encoding:
223
- - gzip, deflate
224
- User-Agent:
225
- - rest-client/2.0.2 (darwin16.7.0 x86_64) ruby/2.3.3p222
226
- Host:
227
- - api.sportradar.us
228
- response:
229
- status:
230
- code: 596
231
- message: '596'
232
- headers:
233
- Content-Type:
234
- - text/xml
235
- Date:
236
- - Thu, 31 May 2018 15:58:02 GMT
237
- Server:
238
- - Mashery Proxy
239
- X-Mashery-Error-Code:
240
- - ERR_596_SERVICE_NOT_FOUND
241
- Content-Length:
242
- - '30'
243
- Connection:
244
- - keep-alive
245
- body:
246
- encoding: UTF-8
247
- base64_string: 'PGgxPjU5NiBTZXJ2aWNlIE5vdCBGb3VuZDwvaDE+
248
-
249
- '
250
- http_version:
251
- recorded_at: Thu, 31 May 2018 15:58:02 GMT
210
+ recorded_at: Thu, 31 May 2018 20:59:15 GMT
252
211
  recorded_with: VCR 3.0.3
@@ -7,7 +7,7 @@ describe SportsDataApi::Nhl::Games, vcr: {
7
7
  } do
8
8
  context 'results from daily schedule fetch' do
9
9
  let(:games) do
10
- SportsDataApi.set_access_level(:nhl, 'ot')
10
+ SportsDataApi.set_access_level(:nhl, 'trial')
11
11
  SportsDataApi.set_key(:nhl, api_key(:nhl))
12
12
  SportsDataApi::Nhl.daily(2013, 12, 12)
13
13
  end
@@ -12,27 +12,55 @@ describe SportsDataApi::Nhl::Player, vcr: {
12
12
  context 'when from team_roster' do
13
13
  let(:roster) { SportsDataApi::Nhl.team_roster('4416091c-0f24-11e2-8525-18a905767e44') }
14
14
  let(:players) { roster.players }
15
- it 'parses out the data' do
16
- player = players.find do |x|
17
- x.player[:id] == '431e124a-0f24-11e2-8525-18a905767e44'
15
+
16
+ context 'when skater' do
17
+ it 'parses out the data' do
18
+ player = players.find do |x|
19
+ x.player[:id] == '431e124a-0f24-11e2-8525-18a905767e44'
20
+ end
21
+ expect(player[:status]).to eq 'ACT'
22
+ expect(player[:full_name]).to eq 'Zach Parise'
23
+ expect(player[:first_name]).to eq 'Zach'
24
+ expect(player[:last_name]).to eq 'Parise'
25
+ expect(player[:abbr_name]).to eq 'Z.Parise'
26
+ expect(player[:height]).to eq 71
27
+ expect(player[:weight]).to eq 196
28
+ expect(player[:position]).to eq 'F'
29
+ expect(player[:primary_position]).to eq 'LW'
30
+ expect(player[:jersey_number]).to eq '11'
31
+ expect(player[:experience]).to eq '12'
32
+ expect(player[:college]).to eq 'North Dakota'
33
+ expect(player[:birth_place]).to eq 'Minneapolis, MN, USA'
34
+ expect(player[:birthdate]).to eq '1984-07-28'
35
+ expect(player[:updated]).to eq '2018-02-08T20:58:31+00:00'
36
+ expect(player[:reference]).to eq '8470610'
37
+ expect(player.stats).to be_nil
38
+ end
39
+ end
40
+
41
+ context 'when goalie' do
42
+ it 'parses out the data' do
43
+ player = players.find do |x|
44
+ x.player[:id] == '42b65a49-0f24-11e2-8525-18a905767e44'
45
+ end
46
+ expect(player[:status]).to eq 'ACT'
47
+ expect(player[:full_name]).to eq 'Devan Dubnyk'
48
+ expect(player[:first_name]).to eq 'Devan'
49
+ expect(player[:last_name]).to eq 'Dubnyk'
50
+ expect(player[:abbr_name]).to eq 'D.Dubnyk'
51
+ expect(player[:height]).to eq 78
52
+ expect(player[:weight]).to eq 213
53
+ expect(player[:position]).to eq 'G'
54
+ expect(player[:primary_position]).to eq 'G'
55
+ expect(player[:jersey_number]).to eq '40'
56
+ expect(player[:experience]).to eq '8'
57
+ expect(player[:college]).to be_nil
58
+ expect(player[:birth_place]).to eq 'Regina, SK, CAN'
59
+ expect(player[:birthdate]).to eq '1986-05-04'
60
+ expect(player[:updated]).to eq '2017-10-05T19:42:04+00:00'
61
+ expect(player[:reference]).to eq '8471227'
62
+ expect(player.stats).to be_nil
18
63
  end
19
- expect(player[:status]).to eq 'ACT'
20
- expect(player[:full_name]).to eq 'Zach Parise'
21
- expect(player[:first_name]).to eq 'Zach'
22
- expect(player[:last_name]).to eq 'Parise'
23
- expect(player[:abbr_name]).to eq 'Z.Parise'
24
- expect(player[:height]).to eq 71
25
- expect(player[:weight]).to eq 196
26
- expect(player[:position]).to eq 'F'
27
- expect(player[:primary_position]).to eq 'LW'
28
- expect(player[:jersey_number]).to eq '11'
29
- expect(player[:experience]).to eq '11'
30
- expect(player[:college]).to eq 'North Dakota'
31
- expect(player[:birth_place]).to eq 'Minneapolis, MN, USA'
32
- expect(player[:birthdate]).to eq '1984-07-28'
33
- expect(player[:updated]).to eq '2018-01-02T18:04:00+00:00'
34
- expect(player[:reference]).to eq '8470610'
35
- expect(player.stats).to be_nil
36
64
  end
37
65
  end
38
66
 
@@ -41,68 +69,113 @@ describe SportsDataApi::Nhl::Player, vcr: {
41
69
  let(:team) { game_summary.home_team }
42
70
  let(:players) { team.players }
43
71
 
44
- it 'parses out the data' do
45
- player = players.find do |x|
46
- x.player[:id] == '431e124a-0f24-11e2-8525-18a905767e44'
72
+ context 'when skater' do
73
+ it 'parses out the data' do
74
+ player = players.find do |x|
75
+ x.player[:id] == '431e124a-0f24-11e2-8525-18a905767e44'
76
+ end
77
+ expect(player[:status]).to be_nil
78
+ expect(player[:full_name]).to eq 'Zach Parise'
79
+ expect(player[:first_name]).to eq 'Zach'
80
+ expect(player[:last_name]).to eq 'Parise'
81
+ expect(player[:position]).to eq 'F'
82
+ expect(player[:primary_position]).to eq 'LW'
83
+ expect(player[:jersey_number]).to eq '11'
84
+ expect(player[:starter]).to eq true
85
+ expect(player[:played]).to eq true
86
+ expect(player.stats).to be_a SportsDataApi::MergedStats
87
+ expect(player.stats[:total_goals]).to eq 0
88
+ expect(player.stats[:total_assists]).to eq 1
89
+ expect(player.stats[:total_penalties]).to eq 1
90
+ expect(player.stats[:total_penalty_minutes]).to eq 2
91
+ expect(player.stats[:total_shots]).to eq 2
92
+ expect(player.stats[:total_blocked_att]).to eq 0
93
+ expect(player.stats[:total_missed_shots]).to eq 2
94
+ expect(player.stats[:total_hits]).to eq 1
95
+ expect(player.stats[:total_giveaways]).to eq 0
96
+ expect(player.stats[:total_takeaways]).to eq 2
97
+ expect(player.stats[:total_blocked_shots]).to eq 2
98
+ expect(player.stats[:total_faceoffs_won]).to eq 0
99
+ expect(player.stats[:total_faceoffs_lost]).to eq 0
100
+ expect(player.stats[:total_plus_minus]).to eq(-1)
101
+ expect(player.stats[:total_shooting_pct]).to eq 0
102
+ expect(player.stats[:total_faceoff_win_pct]).to eq 0
103
+ expect(player.stats[:total_faceoffs]).to eq 0
104
+ expect(player.stats[:total_points]).to eq 1
105
+ expect(player.stats[:powerplay_shots]).to eq 0
106
+ expect(player.stats[:powerplay_goals]).to eq 0
107
+ expect(player.stats[:powerplay_missed_shots]).to eq 0
108
+ expect(player.stats[:powerplay_assists]).to eq 0
109
+ expect(player.stats[:powerplay_faceoffs]).to eq 0
110
+ expect(player.stats[:powerplay_faceoffs_won]).to eq 0
111
+ expect(player.stats[:powerplay_faceoffs_lost]).to eq 0
112
+ expect(player.stats[:powerplay_faceoff_win_pct]).to eq 0
113
+ expect(player.stats[:shorthanded_shots]).to eq 0
114
+ expect(player.stats[:shorthanded_goals]).to eq 0
115
+ expect(player.stats[:shorthanded_missed_shots]).to eq 0
116
+ expect(player.stats[:shorthanded_assists]).to eq 0
117
+ expect(player.stats[:shorthanded_faceoffs]).to eq 0
118
+ expect(player.stats[:shorthanded_faceoffs_won]).to eq 0
119
+ expect(player.stats[:shorthanded_faceoffs_lost]).to eq 0
120
+ expect(player.stats[:shorthanded_faceoff_win_pct]).to eq 0
121
+ expect(player.stats[:evenstrength_shots]).to eq 2
122
+ expect(player.stats[:evenstrength_goals]).to eq 0
123
+ expect(player.stats[:evenstrength_missed_shots]).to eq 2
124
+ expect(player.stats[:evenstrength_assists]).to eq 1
125
+ expect(player.stats[:evenstrength_faceoffs]).to eq 0
126
+ expect(player.stats[:evenstrength_faceoffs_won]).to eq 0
127
+ expect(player.stats[:evenstrength_faceoffs_lost]).to eq 0
128
+ expect(player.stats[:evenstrength_faceoff_win_pct]).to eq 0
129
+ expect(player.stats[:penalty_shots]).to eq 0
130
+ expect(player.stats[:penalty_goals]).to eq 0
131
+ expect(player.stats[:penalty_missed_shots]).to eq 0
132
+ expect(player.stats[:shootout_shots]).to eq 0
133
+ expect(player.stats[:shootout_goals]).to eq 0
134
+ expect(player.stats[:shootout_missed_shots]).to eq 0
135
+ end
136
+ end
137
+
138
+ context 'when goalie' do
139
+ it 'parses out the goaltending stats' do
140
+ player = players.find do |x|
141
+ x.player[:id] == '42b65a49-0f24-11e2-8525-18a905767e44'
142
+ end
143
+ expect(player[:status]).to be_nil
144
+ expect(player[:full_name]).to eq 'Devan Dubnyk'
145
+ expect(player[:first_name]).to eq 'Devan'
146
+ expect(player[:last_name]).to eq 'Dubnyk'
147
+ expect(player[:position]).to eq 'G'
148
+ expect(player[:primary_position]).to eq 'G'
149
+ expect(player[:jersey_number]).to eq '40'
150
+ expect(player[:starter]).to eq true
151
+ expect(player[:played]).to eq true
152
+ expect(player.stats).to be_a SportsDataApi::MergedStats
153
+ expect(player.stats[:total_shots_against]).to eq 17
154
+ expect(player.stats[:total_goals_against]).to eq 3
155
+ expect(player.stats[:total_saves]).to eq 14
156
+ expect(player.stats[:total_credit]).to eq "win"
157
+ expect(player.stats[:total_saves_pct]).to eq 0.824
158
+ expect(player.stats[:powerplay_shots_against]).to eq 0
159
+ expect(player.stats[:powerplay_goals_against]).to eq 0
160
+ expect(player.stats[:powerplay_saves]).to eq 0
161
+ expect(player.stats[:powerplay_saves_pct]).to eq 0
162
+ expect(player.stats[:shorthanded_shots_against]).to eq 2
163
+ expect(player.stats[:shorthanded_goals_against]).to eq 0
164
+ expect(player.stats[:shorthanded_saves]).to eq 2
165
+ expect(player.stats[:shorthanded_saves_pct]).to eq 1.0
166
+ expect(player.stats[:evenstrength_shots_against]).to eq 15
167
+ expect(player.stats[:evenstrength_goals_against]).to eq 3
168
+ expect(player.stats[:evenstrength_saves]).to eq 12
169
+ expect(player.stats[:evenstrength_saves_pct]).to eq 0.8
170
+ expect(player.stats[:penalty_shots_against]).to eq 0
171
+ expect(player.stats[:penalty_goals_against]).to eq 0
172
+ expect(player.stats[:penalty_saves]).to eq 0
173
+ expect(player.stats[:penalty_saves_pct]).to eq 0
174
+ expect(player.stats[:shootout_shots_against]).to eq 0
175
+ expect(player.stats[:shootout_goals_against]).to eq 0
176
+ expect(player.stats[:shootout_saves]).to eq 0
177
+ expect(player.stats[:shootout_saves_pct]).to eq 0
47
178
  end
48
- expect(player[:status]).to be_nil
49
- expect(player[:full_name]).to eq 'Zach Parise'
50
- expect(player[:first_name]).to eq 'Zach'
51
- expect(player[:last_name]).to eq 'Parise'
52
- expect(player[:position]).to eq 'F'
53
- expect(player[:primary_position]).to eq 'LW'
54
- expect(player[:jersey_number]).to eq '11'
55
- expect(player[:starter]).to eq true
56
- expect(player[:played]).to eq true
57
- expect(player.stats).to be_a SportsDataApi::MergedStats
58
- expect(player.stats[:total_goals]).to eq 0
59
- expect(player.stats[:total_assists]).to eq 1
60
- expect(player.stats[:total_penalties]).to eq 1
61
- expect(player.stats[:total_penalty_minutes]).to eq 2
62
- expect(player.stats[:total_shots]).to eq 2
63
- expect(player.stats[:total_blocked_att]).to eq 0
64
- expect(player.stats[:total_missed_shots]).to eq 2
65
- expect(player.stats[:total_hits]).to eq 1
66
- expect(player.stats[:total_giveaways]).to eq 0
67
- expect(player.stats[:total_takeaways]).to eq 2
68
- expect(player.stats[:total_blocked_shots]).to eq 2
69
- expect(player.stats[:total_faceoffs_won]).to eq 0
70
- expect(player.stats[:total_faceoffs_lost]).to eq 0
71
- expect(player.stats[:total_plus_minus]).to eq(-1)
72
- expect(player.stats[:total_shooting_pct]).to eq 0
73
- expect(player.stats[:total_faceoff_win_pct]).to eq 0
74
- expect(player.stats[:total_faceoffs]).to eq 0
75
- expect(player.stats[:total_points]).to eq 1
76
- expect(player.stats[:powerplay_shots]).to eq 0
77
- expect(player.stats[:powerplay_goals]).to eq 0
78
- expect(player.stats[:powerplay_missed_shots]).to eq 0
79
- expect(player.stats[:powerplay_assists]).to eq 0
80
- expect(player.stats[:powerplay_faceoffs]).to eq 0
81
- expect(player.stats[:powerplay_faceoffs_won]).to eq 0
82
- expect(player.stats[:powerplay_faceoffs_lost]).to eq 0
83
- expect(player.stats[:powerplay_faceoff_win_pct]).to eq 0
84
- expect(player.stats[:shorthanded_shots]).to eq 0
85
- expect(player.stats[:shorthanded_goals]).to eq 0
86
- expect(player.stats[:shorthanded_missed_shots]).to eq 0
87
- expect(player.stats[:shorthanded_assists]).to eq 0
88
- expect(player.stats[:shorthanded_faceoffs]).to eq 0
89
- expect(player.stats[:shorthanded_faceoffs_won]).to eq 0
90
- expect(player.stats[:shorthanded_faceoffs_lost]).to eq 0
91
- expect(player.stats[:shorthanded_faceoff_win_pct]).to eq 0
92
- expect(player.stats[:evenstrength_shots]).to eq 2
93
- expect(player.stats[:evenstrength_goals]).to eq 0
94
- expect(player.stats[:evenstrength_missed_shots]).to eq 2
95
- expect(player.stats[:evenstrength_assists]).to eq 1
96
- expect(player.stats[:evenstrength_faceoffs]).to eq 0
97
- expect(player.stats[:evenstrength_faceoffs_won]).to eq 0
98
- expect(player.stats[:evenstrength_faceoffs_lost]).to eq 0
99
- expect(player.stats[:evenstrength_faceoff_win_pct]).to eq 0
100
- expect(player.stats[:penalty_shots]).to eq 0
101
- expect(player.stats[:penalty_goals]).to eq 0
102
- expect(player.stats[:penalty_missed_shots]).to eq 0
103
- expect(player.stats[:shootout_shots]).to eq 0
104
- expect(player.stats[:shootout_goals]).to eq 0
105
- expect(player.stats[:shootout_missed_shots]).to eq 0
106
179
  end
107
180
  end
108
181
  end
@@ -36,7 +36,7 @@ describe SportsDataApi::Nhl::Team, vcr: {
36
36
  its(:name) { should eq 'Wild' }
37
37
  its(:points) { should be_nil }
38
38
  it 'parses players' do
39
- expect(subject.players.count).to eq 24
39
+ expect(subject.players.count).to eq 36
40
40
  expect(subject.players.first).to be_a SportsDataApi::Nhl::Player
41
41
  end
42
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sports_data_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Lovelett
@@ -508,7 +508,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
508
508
  version: '0'
509
509
  requirements: []
510
510
  rubyforge_project:
511
- rubygems_version: 2.5.2
511
+ rubygems_version: 2.7.7
512
512
  signing_key:
513
513
  specification_version: 4
514
514
  summary: Sportradar’s comprehensive data coverage includes all major U.S. sports,