sports_data_api 0.13.0 → 0.14.0

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
- SHA256:
3
- metadata.gz: cbf259487fe366744f521ad3b30bb5e4135c6bf514d45c3f6f1cfcd39e08edda
4
- data.tar.gz: 4b787131f7ccd8ab11645292a92260e62a034c037ebf6dad576b2608ba58c03f
2
+ SHA1:
3
+ metadata.gz: e5e93f381c616ef9ff64c811f387feff83cc7906
4
+ data.tar.gz: be5bba5bb5537373623d429a764d474545db9df7
5
5
  SHA512:
6
- metadata.gz: 21daae5927341cf9fa9421affff4fae33b0eaa19c9988e80732a7905dafecb3507d939d80ff5323e49ad46bf518b6a9eb92e59a64ba570b7119fb9fd05eac37e
7
- data.tar.gz: a2e3e1c5586471ecffa85f56a3b01f17262bed8cbefcff029c68f0ccb80f70aa9a4d968fa193ccfe049a5a91746a96722b7b0e38bdb0d84da173be9f4a1f2597
6
+ metadata.gz: d94b2a7cb477a33ea8004f0ca8bb6fb79f03e4a5720ab19e40ffc8f7f40506c5fc034450afdbb16c7f051cc4dda12164a1c84746c4a01e53bb17dbf26d0b6acf
7
+ data.tar.gz: 716dda446a8975d6a22ed1be93025356471f4e99ef50132562fc7b8924ddb2c3fcfcad5b1352b621288d4304acbe3bed57fbc444d49bf624e4db52afcace7aac
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # CHANGELOG
2
+
3
+ ## v0.14.0
4
+
5
+ * [#88](https://github.com/RLovelett/sports_data_api/pull/88) Change SportsDataApi::Exception => SportsDataApi::Error
@@ -0,0 +1,4 @@
1
+ module SportsDataApi
2
+ class Error < StandardError
3
+ end
4
+ end
@@ -2,9 +2,6 @@ module SportsDataApi
2
2
  module Golf
3
3
  extend SportsDataApi::Request
4
4
 
5
- class Exception < ::Exception
6
- end
7
-
8
5
  API_VERSION = 2
9
6
  BASE_URL = 'https://api.sportsdatallc.org/golf-%{access_level}%{version}'
10
7
  DIR = File.join(File.dirname(__FILE__), 'golf')
@@ -2,9 +2,6 @@ module SportsDataApi
2
2
  module Mlb
3
3
  extend SportsDataApi::Request
4
4
 
5
- class Exception < ::Exception
6
- end
7
-
8
5
  API_VERSION = 6
9
6
  BASE_URL = 'https://api.sportradar.us/mlb-%{access_level}%{version}'
10
7
  DIR = File.join(File.dirname(__FILE__), 'mlb')
@@ -2,9 +2,6 @@ module SportsDataApi
2
2
  module Nba
3
3
  extend SportsDataApi::Request
4
4
 
5
- class Exception < ::Exception
6
- end
7
-
8
5
  API_VERSION = 4
9
6
  BASE_URL = 'https://api.sportradar.us/nba/%{access_level}/v%{version}/en'
10
7
  DIR = File.join(File.dirname(__FILE__), 'nba')
@@ -25,7 +22,7 @@ module SportsDataApi
25
22
  # Fetches NBA season schedule for a given year and season
26
23
  def schedule(year, season)
27
24
  season = season.to_s.upcase.to_sym
28
- raise Exception.new("#{season} is not a valid season") unless Season.valid?(season)
25
+ raise Error.new("#{season} is not a valid season") unless Season.valid?(season)
29
26
 
30
27
  Season.new(response_json("/games/#{year}/#{season}/schedule.json"))
31
28
  end
@@ -2,9 +2,6 @@ module SportsDataApi
2
2
  module Ncaafb
3
3
  extend SportsDataApi::Request
4
4
 
5
- class Exception < ::Exception
6
- end
7
-
8
5
  API_VERSION = 1
9
6
  BASE_URL = 'https://api.sportsdatallc.org/ncaafb-%{access_level}%{version}'
10
7
  DIR = File.join(File.dirname(__FILE__), 'ncaafb')
@@ -45,8 +42,8 @@ module SportsDataApi
45
42
 
46
43
  # Fetches Ncaafb season ranking for a given year , poll and week
47
44
  def rankings(year, poll, week)
48
- raise Exception.new("#{poll} is not a valid poll") unless Polls.valid_name?(poll)
49
- raise Exception.new("#{week} nr is not a valid week nr") unless Polls.valid_week?(week)
45
+ raise Error.new("#{poll} is not a valid poll") unless Polls.valid_name?(poll)
46
+ raise Error.new("#{week} nr is not a valid week nr") unless Polls.valid_week?(week)
50
47
 
51
48
  response = response_json("/polls/#{poll}/#{year}/#{week}/rankings.json")
52
49
  Polls.new(response)
@@ -2,9 +2,6 @@ module SportsDataApi
2
2
  module Ncaamb
3
3
  extend SportsDataApi::Request
4
4
 
5
- class Exception < ::Exception
6
- end
7
-
8
5
  API_VERSION = 3
9
6
  BASE_URL = 'https://api.sportsdatallc.org/ncaamb-%{access_level}%{version}'
10
7
  DIR = File.join(File.dirname(__FILE__), 'ncaamb')
@@ -28,7 +25,7 @@ module SportsDataApi
28
25
  # Fetches NCAAAMB season schedule for a given year and season
29
26
  def schedule(year, season)
30
27
  season = season.to_s.upcase.to_sym
31
- raise Exception.new("#{season} is not a valid season") unless Season.valid?(season)
28
+ raise Error.new("#{season} is not a valid season") unless Season.valid?(season)
32
29
 
33
30
  Season.new(response_xml_xpath("/games/#{year}/#{season}/schedule.xml", '/league/season-schedule'))
34
31
  end
@@ -60,13 +57,13 @@ module SportsDataApi
60
57
  # Fetches NCAAAMB tournaments for a given year and season
61
58
  def tournament_list(year, season)
62
59
  season = season.to_s.upcase.to_sym
63
- raise Exception.new("#{season} is not a valid season") unless TournamentList.valid?(season)
60
+ raise Error.new("#{season} is not a valid season") unless TournamentList.valid?(season)
64
61
 
65
62
  TournamentList.new(response_xml_xpath("/tournaments/#{year}/#{season}/schedule.xml", '/league/season-schedule'))
66
63
  end
67
64
 
68
65
  def tournament_schedule(year, season, tournament_id)
69
- raise Exception.new("#{season} is not a valid season") unless TournamentSchedule.valid?(season)
66
+ raise Error.new("#{season} is not a valid season") unless TournamentSchedule.valid?(season)
70
67
 
71
68
  TournamentSchedule.new(year, season, response_xml_xpath("/tournaments/#{tournament_id}/schedule.xml", '/league/tournament-schedule'))
72
69
  end
@@ -2,9 +2,6 @@ module SportsDataApi
2
2
  module Nhl
3
3
  extend SportsDataApi::Request
4
4
 
5
- class Exception < ::Exception
6
- end
7
-
8
5
  API_VERSION = 5
9
6
  BASE_URL = 'https://api.sportradar.us/nhl/%{access_level}/v%{version}/en'
10
7
  DIR = File.join(File.dirname(__FILE__), 'nhl')
@@ -24,7 +21,7 @@ module SportsDataApi
24
21
  # Fetches NHL season schedule for a given year and season
25
22
  def schedule(year, season)
26
23
  season = season.to_s.upcase.to_sym
27
- raise Exception.new("#{season} is not a valid season") unless Season.valid?(season)
24
+ raise Error.new("#{season} is not a valid season") unless Season.valid?(season)
28
25
 
29
26
  Season.new(response_json("/games/#{year}/#{season}/schedule.json"))
30
27
  end
@@ -1,3 +1,3 @@
1
1
  module SportsDataApi
2
- VERSION = '0.13.0'
2
+ VERSION = '0.14.0'
3
3
  end
@@ -33,9 +33,9 @@ module SportsDataApi
33
33
  begin
34
34
  RestClient.get(url, params: { api_key: SportsDataApi.key(sport) })
35
35
  rescue RestClient::RequestTimeout
36
- raise Exception, 'The API did not respond in a reasonable amount of time'
36
+ raise Error, 'The API did not respond in a reasonable amount of time'
37
37
  rescue RestClient::Exception => e
38
- raise Exception, exception_message(e)
38
+ raise Error, exception_message(e)
39
39
  end
40
40
  end
41
41
 
@@ -54,7 +54,7 @@ module SportsDataApi
54
54
 
55
55
  LIBRARY_PATH = File.join(File.dirname(__FILE__), 'sports_data_api')
56
56
 
57
- autoload :Exception, File.join(LIBRARY_PATH, 'exception')
57
+ autoload :Error, File.join(LIBRARY_PATH, 'error')
58
58
  autoload :Golf, File.join(LIBRARY_PATH, 'golf')
59
59
  autoload :JsonData, File.join(LIBRARY_PATH, 'json_data')
60
60
  autoload :MergedStats, File.join(LIBRARY_PATH, 'merged_stats')
@@ -29585,4 +29585,121 @@ http_interactions:
29585
29585
  WW9yayBSYW5nZXJzIiwiYWxpYXMiOiJOWVIifX1dfQ==
29586
29586
  http_version:
29587
29587
  recorded_at: Wed, 10 Jan 2018 21:47:01 GMT
29588
+ - request:
29589
+ method: get
29590
+ uri: https://api.sportradar.us/nhl/ot/v5/en/games/2017/REG/schedule.json?api_key=<API_KEY>
29591
+ body:
29592
+ encoding: US-ASCII
29593
+ base64_string: ''
29594
+ headers:
29595
+ Accept:
29596
+ - "*/*"
29597
+ Accept-Encoding:
29598
+ - gzip, deflate
29599
+ User-Agent:
29600
+ - rest-client/2.0.2 (darwin16.7.0 x86_64) ruby/2.3.3p222
29601
+ Host:
29602
+ - api.sportradar.us
29603
+ response:
29604
+ status:
29605
+ code: 596
29606
+ message: '596'
29607
+ headers:
29608
+ Content-Type:
29609
+ - text/xml
29610
+ Date:
29611
+ - Thu, 31 May 2018 15:57:47 GMT
29612
+ Server:
29613
+ - Mashery Proxy
29614
+ X-Mashery-Error-Code:
29615
+ - ERR_596_SERVICE_NOT_FOUND
29616
+ Content-Length:
29617
+ - '30'
29618
+ Connection:
29619
+ - keep-alive
29620
+ body:
29621
+ encoding: UTF-8
29622
+ base64_string: 'PGgxPjU5NiBTZXJ2aWNlIE5vdCBGb3VuZDwvaDE+
29623
+
29624
+ '
29625
+ http_version:
29626
+ recorded_at: Thu, 31 May 2018 15:57:47 GMT
29627
+ - request:
29628
+ method: get
29629
+ uri: https://api.sportradar.us/nhl/ot/v5/en/games/6d20bdbd-b5e0-46ab-8b98-45ea01ab0e2b/summary.json?api_key=<API_KEY>
29630
+ body:
29631
+ encoding: US-ASCII
29632
+ base64_string: ''
29633
+ headers:
29634
+ Accept:
29635
+ - "*/*"
29636
+ Accept-Encoding:
29637
+ - gzip, deflate
29638
+ User-Agent:
29639
+ - rest-client/2.0.2 (darwin16.7.0 x86_64) ruby/2.3.3p222
29640
+ Host:
29641
+ - api.sportradar.us
29642
+ response:
29643
+ status:
29644
+ code: 596
29645
+ message: '596'
29646
+ headers:
29647
+ Content-Type:
29648
+ - text/xml
29649
+ Date:
29650
+ - Thu, 31 May 2018 15:57:48 GMT
29651
+ Server:
29652
+ - Mashery Proxy
29653
+ X-Mashery-Error-Code:
29654
+ - ERR_596_SERVICE_NOT_FOUND
29655
+ Content-Length:
29656
+ - '30'
29657
+ Connection:
29658
+ - keep-alive
29659
+ body:
29660
+ encoding: UTF-8
29661
+ base64_string: 'PGgxPjU5NiBTZXJ2aWNlIE5vdCBGb3VuZDwvaDE+
29662
+
29663
+ '
29664
+ http_version:
29665
+ recorded_at: Thu, 31 May 2018 15:57:48 GMT
29666
+ - request:
29667
+ method: get
29668
+ uri: https://api.sportradar.us/nhl/ot/v5/en/games/2018/1/1/schedule.json?api_key=<API_KEY>
29669
+ body:
29670
+ encoding: US-ASCII
29671
+ base64_string: ''
29672
+ headers:
29673
+ Accept:
29674
+ - "*/*"
29675
+ Accept-Encoding:
29676
+ - gzip, deflate
29677
+ User-Agent:
29678
+ - rest-client/2.0.2 (darwin16.7.0 x86_64) ruby/2.3.3p222
29679
+ Host:
29680
+ - api.sportradar.us
29681
+ response:
29682
+ status:
29683
+ code: 596
29684
+ message: '596'
29685
+ headers:
29686
+ Content-Type:
29687
+ - text/xml
29688
+ Date:
29689
+ - Thu, 31 May 2018 15:57:49 GMT
29690
+ Server:
29691
+ - Mashery Proxy
29692
+ X-Mashery-Error-Code:
29693
+ - ERR_596_SERVICE_NOT_FOUND
29694
+ Content-Length:
29695
+ - '30'
29696
+ Connection:
29697
+ - keep-alive
29698
+ body:
29699
+ encoding: UTF-8
29700
+ base64_string: 'PGgxPjU5NiBTZXJ2aWNlIE5vdCBGb3VuZDwvaDE+
29701
+
29702
+ '
29703
+ http_version:
29704
+ recorded_at: Thu, 31 May 2018 15:57:49 GMT
29588
29705
  recorded_with: VCR 3.0.3
@@ -15713,4 +15713,43 @@ http_interactions:
15713
15713
  REFMIn19XX0=
15714
15714
  http_version:
15715
15715
  recorded_at: Wed, 10 Jan 2018 19:23:06 GMT
15716
+ - request:
15717
+ method: get
15718
+ uri: https://api.sportradar.us/nhl/ot/v5/en/games/2013/REG/schedule.json?api_key=<API_KEY>
15719
+ body:
15720
+ encoding: US-ASCII
15721
+ base64_string: ''
15722
+ headers:
15723
+ Accept:
15724
+ - "*/*"
15725
+ Accept-Encoding:
15726
+ - gzip, deflate
15727
+ User-Agent:
15728
+ - rest-client/2.0.2 (darwin16.7.0 x86_64) ruby/2.3.3p222
15729
+ Host:
15730
+ - api.sportradar.us
15731
+ response:
15732
+ status:
15733
+ code: 596
15734
+ message: '596'
15735
+ headers:
15736
+ Content-Type:
15737
+ - text/xml
15738
+ Date:
15739
+ - Thu, 31 May 2018 15:57:14 GMT
15740
+ Server:
15741
+ - Mashery Proxy
15742
+ X-Mashery-Error-Code:
15743
+ - ERR_596_SERVICE_NOT_FOUND
15744
+ Content-Length:
15745
+ - '30'
15746
+ Connection:
15747
+ - keep-alive
15748
+ body:
15749
+ encoding: UTF-8
15750
+ base64_string: 'PGgxPjU5NiBTZXJ2aWNlIE5vdCBGb3VuZDwvaDE+
15751
+
15752
+ '
15753
+ http_version:
15754
+ recorded_at: Thu, 31 May 2018 15:57:14 GMT
15716
15755
  recorded_with: VCR 3.0.3
@@ -210,4 +210,43 @@ http_interactions:
210
210
  bmVzb3RhIFdpbGQiLCJhbGlhcyI6Ik1JTiJ9fV19
211
211
  http_version:
212
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
213
252
  recorded_with: VCR 3.0.3
@@ -11,44 +11,44 @@ describe SportsDataApi::Golf, vcr: {
11
11
  SportsDataApi.set_access_level(:golf, 't')
12
12
  end
13
13
  describe '.season' do
14
- it { expect { subject.season(:pga, 2016) }.to raise_error(SportsDataApi::Exception) }
14
+ it { expect { subject.season(:pga, 2016) }.to raise_error(SportsDataApi::Error) }
15
15
  end
16
16
  describe '.players' do
17
- it { expect { subject.players(:pga, 2016) }.to raise_error(SportsDataApi::Exception) }
17
+ it { expect { subject.players(:pga, 2016) }.to raise_error(SportsDataApi::Error) }
18
18
  end
19
19
  describe '.summary' do
20
- it { expect { subject.summary(:pga, 2016, 'id') }.to raise_error(SportsDataApi::Exception) }
20
+ it { expect { subject.summary(:pga, 2016, 'id') }.to raise_error(SportsDataApi::Error) }
21
21
  end
22
22
  describe '.tee_times' do
23
- it { expect { subject.tee_times(:pga, 2016, 'id', 1) }.to raise_error(SportsDataApi::Exception) }
23
+ it { expect { subject.tee_times(:pga, 2016, 'id', 1) }.to raise_error(SportsDataApi::Error) }
24
24
  end
25
25
  describe '.scorecards' do
26
- it { expect { subject.scorecards(:pga, 2016, 'id', 1) }.to raise_error(SportsDataApi::Exception) }
26
+ it { expect { subject.scorecards(:pga, 2016, 'id', 1) }.to raise_error(SportsDataApi::Error) }
27
27
  end
28
28
  describe '.leaderboard' do
29
- it { expect { subject.leaderboard(:pga, 2016, 'id') }.to raise_error(SportsDataApi::Exception) }
29
+ it { expect { subject.leaderboard(:pga, 2016, 'id') }.to raise_error(SportsDataApi::Error) }
30
30
  end
31
31
  end
32
32
 
33
33
  context 'no response from the api' do
34
34
  before { stub_request(:any, /api\.sportsdatallc\.org.*/).to_timeout }
35
35
  describe '.season' do
36
- it { expect { subject.season(:pga, 2016) }.to raise_error(SportsDataApi::Exception) }
36
+ it { expect { subject.season(:pga, 2016) }.to raise_error(SportsDataApi::Error) }
37
37
  end
38
38
  describe '.players' do
39
- it { expect { subject.players(:pga, 2016) }.to raise_error(SportsDataApi::Exception) }
39
+ it { expect { subject.players(:pga, 2016) }.to raise_error(SportsDataApi::Error) }
40
40
  end
41
41
  describe '.summary' do
42
- it { expect { subject.summary(:pga, 2016, '123') }.to raise_error(SportsDataApi::Exception) }
42
+ it { expect { subject.summary(:pga, 2016, '123') }.to raise_error(SportsDataApi::Error) }
43
43
  end
44
44
  describe '.tee_times' do
45
- it { expect { subject.tee_times(:pga, 2016, '123', 1) }.to raise_error(SportsDataApi::Exception) }
45
+ it { expect { subject.tee_times(:pga, 2016, '123', 1) }.to raise_error(SportsDataApi::Error) }
46
46
  end
47
47
  describe '.scorecards' do
48
- it { expect { subject.scorecards(:pga, 2016, '123', 1) }.to raise_error(SportsDataApi::Exception) }
48
+ it { expect { subject.scorecards(:pga, 2016, '123', 1) }.to raise_error(SportsDataApi::Error) }
49
49
  end
50
50
  describe '.leaderboard' do
51
- it { expect { subject.leaderboard(:pga, 2016, '123') }.to raise_error(SportsDataApi::Exception) }
51
+ it { expect { subject.leaderboard(:pga, 2016, '123') }.to raise_error(SportsDataApi::Error) }
52
52
  end
53
53
  end
54
54
 
@@ -11,50 +11,50 @@ describe SportsDataApi::Mlb do
11
11
  SportsDataApi.set_access_level(:mlb, 't')
12
12
  end
13
13
  describe '.leagues' do
14
- it { expect { subject.leagues }.to raise_error(SportsDataApi::Exception) }
14
+ it { expect { subject.leagues }.to raise_error(SportsDataApi::Error) }
15
15
  end
16
16
  describe '.teams' do
17
- it { expect { subject.teams }.to raise_error(SportsDataApi::Exception) }
17
+ it { expect { subject.teams }.to raise_error(SportsDataApi::Error) }
18
18
  end
19
19
  describe '.season_schedule' do
20
- it { expect { subject.season_schedule(2017, :REG) }.to raise_error(SportsDataApi::Exception) }
20
+ it { expect { subject.season_schedule(2017, :REG) }.to raise_error(SportsDataApi::Error) }
21
21
  end
22
22
  describe '.daily_schedule' do
23
- it { expect { subject.daily_schedule(2016, 9, 24) }.to raise_error(SportsDataApi::Exception) }
23
+ it { expect { subject.daily_schedule(2016, 9, 24) }.to raise_error(SportsDataApi::Error) }
24
24
  end
25
25
  describe '.daily_summary' do
26
- it { expect { subject.daily_summary(2016, 9, 24) }.to raise_error(SportsDataApi::Exception) }
26
+ it { expect { subject.daily_summary(2016, 9, 24) }.to raise_error(SportsDataApi::Error) }
27
27
  end
28
28
  describe '.game' do
29
- it { expect { subject.game('4f46825d-8172-47bc-9f06-2a162c330ffb') }.to raise_error(SportsDataApi::Exception) }
29
+ it { expect { subject.game('4f46825d-8172-47bc-9f06-2a162c330ffb') }.to raise_error(SportsDataApi::Error) }
30
30
  end
31
31
  describe '.team' do
32
- it { expect { subject.team('575c19b7-4052-41c2-9f0a-1c5813d02f99') }.to raise_error(SportsDataApi::Exception) }
32
+ it { expect { subject.team('575c19b7-4052-41c2-9f0a-1c5813d02f99') }.to raise_error(SportsDataApi::Error) }
33
33
  end
34
34
  end
35
35
 
36
36
  context 'no response from the api' do
37
37
  before { stub_request(:any, /api\.sportradar\.us.*/).to_timeout }
38
38
  describe '.leagues' do
39
- it { expect { subject.leagues }.to raise_error(SportsDataApi::Exception) }
39
+ it { expect { subject.leagues }.to raise_error(SportsDataApi::Error) }
40
40
  end
41
41
  describe '.teams' do
42
- it { expect { subject.teams }.to raise_error(SportsDataApi::Exception) }
42
+ it { expect { subject.teams }.to raise_error(SportsDataApi::Error) }
43
43
  end
44
44
  describe '.season_schedule' do
45
- it { expect { subject.season_schedule(2017, :REG) }.to raise_error(SportsDataApi::Exception) }
45
+ it { expect { subject.season_schedule(2017, :REG) }.to raise_error(SportsDataApi::Error) }
46
46
  end
47
47
  describe '.daily_schedule' do
48
- it { expect { subject.daily_schedule(2016, 9,24) }.to raise_error(SportsDataApi::Exception) }
48
+ it { expect { subject.daily_schedule(2016, 9,24) }.to raise_error(SportsDataApi::Error) }
49
49
  end
50
50
  describe '.daily_summary' do
51
- it { expect { subject.daily_summary(2016, 9,24) }.to raise_error(SportsDataApi::Exception) }
51
+ it { expect { subject.daily_summary(2016, 9,24) }.to raise_error(SportsDataApi::Error) }
52
52
  end
53
53
  describe '.game' do
54
- it { expect { subject.game('4f46825d-8172-47bc-9f06-2a162c330ffb') }.to raise_error(SportsDataApi::Exception) }
54
+ it { expect { subject.game('4f46825d-8172-47bc-9f06-2a162c330ffb') }.to raise_error(SportsDataApi::Error) }
55
55
  end
56
56
  describe '.team' do
57
- it { expect { subject.team('575c19b7-4052-41c2-9f0a-1c5813d02f99') }.to raise_error(SportsDataApi::Exception) }
57
+ it { expect { subject.team('575c19b7-4052-41c2-9f0a-1c5813d02f99') }.to raise_error(SportsDataApi::Error) }
58
58
  end
59
59
  end
60
60
 
@@ -13,23 +13,23 @@ describe SportsDataApi::Nba, vcr: {
13
13
  end
14
14
 
15
15
  describe '.schedule' do
16
- it { expect { subject.schedule(2017, :REG) }.to raise_error(SportsDataApi::Exception) }
16
+ it { expect { subject.schedule(2017, :REG) }.to raise_error(SportsDataApi::Error) }
17
17
  end
18
18
 
19
19
  describe '.team_roster' do
20
- it { expect { subject.team_roster('team_uuid') }.to raise_error(SportsDataApi::Exception) }
20
+ it { expect { subject.team_roster('team_uuid') }.to raise_error(SportsDataApi::Error) }
21
21
  end
22
22
 
23
23
  describe '.game_summary' do
24
- it { expect { subject.game_summary('game_uuid') }.to raise_error(SportsDataApi::Exception) }
24
+ it { expect { subject.game_summary('game_uuid') }.to raise_error(SportsDataApi::Error) }
25
25
  end
26
26
 
27
27
  describe '.teams' do
28
- it { expect { subject.teams }.to raise_error(SportsDataApi::Exception) }
28
+ it { expect { subject.teams }.to raise_error(SportsDataApi::Error) }
29
29
  end
30
30
 
31
31
  describe '.daily' do
32
- it { expect { subject.daily(2017, 1, 1) }.to raise_error(SportsDataApi::Exception) }
32
+ it { expect { subject.daily(2017, 1, 1) }.to raise_error(SportsDataApi::Error) }
33
33
  end
34
34
  end
35
35
 
@@ -42,23 +42,23 @@ describe SportsDataApi::Nba, vcr: {
42
42
  before { stub_request(:any, /api\.sportradar\.us.*/).to_timeout }
43
43
 
44
44
  describe '.schedule' do
45
- it { expect { subject.schedule(2017, :REG) }.to raise_error(SportsDataApi::Exception) }
45
+ it { expect { subject.schedule(2017, :REG) }.to raise_error(SportsDataApi::Error) }
46
46
  end
47
47
 
48
48
  describe '.team_roster' do
49
- it { expect { subject.team_roster('team_uuid') }.to raise_error(SportsDataApi::Exception) }
49
+ it { expect { subject.team_roster('team_uuid') }.to raise_error(SportsDataApi::Error) }
50
50
  end
51
51
 
52
52
  describe '.game_summary' do
53
- it { expect { subject.game_summary('game_uuid') }.to raise_error(SportsDataApi::Exception) }
53
+ it { expect { subject.game_summary('game_uuid') }.to raise_error(SportsDataApi::Error) }
54
54
  end
55
55
 
56
56
  describe '.teams' do
57
- it { expect { subject.teams }.to raise_error(SportsDataApi::Exception) }
57
+ it { expect { subject.teams }.to raise_error(SportsDataApi::Error) }
58
58
  end
59
59
 
60
60
  describe '.daily' do
61
- it { expect { subject.daily(2017, 1, 1) }.to raise_error(SportsDataApi::Exception) }
61
+ it { expect { subject.daily(2017, 1, 1) }.to raise_error(SportsDataApi::Error) }
62
62
  end
63
63
  end
64
64
 
@@ -13,43 +13,43 @@ describe SportsDataApi::Ncaafb, vcr: {
13
13
  end
14
14
 
15
15
  describe '.rankings' do
16
- it { expect { subject.rankings(2014, :AP25, 22) }.to raise_error(SportsDataApi::Ncaafb::Exception) }
17
- it { expect { subject.rankings(2014, :AP10, 12) }.to raise_error(SportsDataApi::Ncaafb::Exception) }
16
+ it { expect { subject.rankings(2014, :AP25, 22) }.to raise_error(SportsDataApi::Error) }
17
+ it { expect { subject.rankings(2014, :AP10, 12) }.to raise_error(SportsDataApi::Error) }
18
18
  end
19
19
 
20
20
  describe '.schedule' do
21
- it { expect { subject.schedule(2013, :REG) }.to raise_error(SportsDataApi::Exception) }
21
+ it { expect { subject.schedule(2013, :REG) }.to raise_error(SportsDataApi::Error) }
22
22
  end
23
23
 
24
24
  describe '.boxscore' do
25
- it { expect { subject.boxscore(2014, :REG, 10, 'IOW', 'NW') }.to raise_error(SportsDataApi::Exception) }
25
+ it { expect { subject.boxscore(2014, :REG, 10, 'IOW', 'NW') }.to raise_error(SportsDataApi::Error) }
26
26
  end
27
27
 
28
28
  describe '.game_roster' do
29
- it { expect { subject.game_roster(2014, :REG, 10, 'IOW', 'NW') }.to raise_error(SportsDataApi::Exception) }
29
+ it { expect { subject.game_roster(2014, :REG, 10, 'IOW', 'NW') }.to raise_error(SportsDataApi::Error) }
30
30
  end
31
31
 
32
32
  describe '.weekly' do
33
- it { expect { subject.weekly(2013, :REG, 1) }.to raise_error(SportsDataApi::Exception) }
33
+ it { expect { subject.weekly(2013, :REG, 1) }.to raise_error(SportsDataApi::Error) }
34
34
  end
35
35
  end
36
36
 
37
37
  context 'no response from the api' do
38
38
  before(:each) { stub_request(:any, /api\.sportsdatallc\.org.*/).to_timeout }
39
39
  describe '.schedule' do
40
- it { expect { subject.schedule(2014, :REG) }.to raise_error(SportsDataApi::Exception) }
40
+ it { expect { subject.schedule(2014, :REG) }.to raise_error(SportsDataApi::Error) }
41
41
  end
42
42
 
43
43
  describe '.boxscore' do
44
- it { expect { subject.boxscore(2014, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Exception) }
44
+ it { expect { subject.boxscore(2014, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Error) }
45
45
  end
46
46
 
47
47
  describe '.game_roster' do
48
- it { expect { subject.game_roster(2014, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Exception) }
48
+ it { expect { subject.game_roster(2014, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Error) }
49
49
  end
50
50
 
51
51
  describe '.weekly' do
52
- it { expect { subject.weekly(2014, :REG, 22) }.to raise_error(SportsDataApi::Exception) }
52
+ it { expect { subject.weekly(2014, :REG, 22) }.to raise_error(SportsDataApi::Error) }
53
53
  end
54
54
  end
55
55
 
@@ -12,14 +12,14 @@ describe SportsDataApi::Ncaamb, vcr: {
12
12
  SportsDataApi.set_access_level(:ncaamb, 't')
13
13
  end
14
14
  describe '.schedule' do
15
- it { expect { subject.schedule(2014, :REG) }.to raise_error(SportsDataApi::Exception) }
15
+ it { expect { subject.schedule(2014, :REG) }.to raise_error(SportsDataApi::Error) }
16
16
  end
17
17
  end
18
18
 
19
19
  context 'no response from the api' do
20
20
  before(:each) { stub_request(:any, /api\.sportsdatallc\.org.*/).to_timeout }
21
21
  describe '.schedule' do
22
- it { expect { subject.schedule(2014, :REG) }.to raise_error(SportsDataApi::Exception) }
22
+ it { expect { subject.schedule(2014, :REG) }.to raise_error(SportsDataApi::Error) }
23
23
  end
24
24
  end
25
25
 
@@ -12,32 +12,32 @@ describe SportsDataApi::Nfl, vcr: {
12
12
  SportsDataApi.set_access_level(:nfl, 't')
13
13
  end
14
14
  describe '.schedule' do
15
- it { expect { subject.schedule(2013, :REG) }.to raise_error(SportsDataApi::Exception) }
15
+ it { expect { subject.schedule(2013, :REG) }.to raise_error(SportsDataApi::Error) }
16
16
  end
17
17
  describe '.boxscore' do
18
- it { expect { subject.boxscore(2012, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Exception) }
18
+ it { expect { subject.boxscore(2012, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Error) }
19
19
  end
20
20
  describe '.game_roster' do
21
- it { expect { subject.game_roster(2012, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Exception) }
21
+ it { expect { subject.game_roster(2012, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Error) }
22
22
  end
23
23
  describe '.weekly' do
24
- it { expect { subject.weekly(2013, :PRE, 1) }.to raise_error(SportsDataApi::Exception) }
24
+ it { expect { subject.weekly(2013, :PRE, 1) }.to raise_error(SportsDataApi::Error) }
25
25
  end
26
26
  end
27
27
 
28
28
  context 'no response from the api' do
29
29
  before(:each) { stub_request(:any, /api\.sportsdatallc\.org.*/).to_timeout }
30
30
  describe '.schedule' do
31
- it { expect { subject.schedule(2013, :REG) }.to raise_error(SportsDataApi::Exception) }
31
+ it { expect { subject.schedule(2013, :REG) }.to raise_error(SportsDataApi::Error) }
32
32
  end
33
33
  describe '.boxscore' do
34
- it { expect { subject.boxscore(2012, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Exception) }
34
+ it { expect { subject.boxscore(2012, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Error) }
35
35
  end
36
36
  describe '.game_roster' do
37
- it { expect { subject.game_roster(2012, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Exception) }
37
+ it { expect { subject.game_roster(2012, :REG, 9, 'IND', 'MIA') }.to raise_error(SportsDataApi::Error) }
38
38
  end
39
39
  describe '.weekly' do
40
- it { expect { subject.weekly(2013, :PRE, 1) }.to raise_error(SportsDataApi::Exception) }
40
+ it { expect { subject.weekly(2013, :PRE, 1) }.to raise_error(SportsDataApi::Error) }
41
41
  end
42
42
  end
43
43
 
@@ -13,23 +13,23 @@ describe SportsDataApi::Nhl, vcr: {
13
13
  end
14
14
 
15
15
  describe '.schedule' do
16
- it { expect { subject.schedule(2017, :REG) }.to raise_error(SportsDataApi::Exception) }
16
+ it { expect { subject.schedule(2017, :REG) }.to raise_error(SportsDataApi::Error) }
17
17
  end
18
18
 
19
19
  describe '.team_roster' do
20
- it { expect { subject.team_roster('team_uuid') }.to raise_error(SportsDataApi::Exception) }
20
+ it { expect { subject.team_roster('team_uuid') }.to raise_error(SportsDataApi::Error) }
21
21
  end
22
22
 
23
23
  describe '.game_summary' do
24
- it { expect { subject.game_summary('game_uuid') }.to raise_error(SportsDataApi::Exception) }
24
+ it { expect { subject.game_summary('game_uuid') }.to raise_error(SportsDataApi::Error) }
25
25
  end
26
26
 
27
27
  describe '.teams' do
28
- it { expect { subject.teams }.to raise_error(SportsDataApi::Exception) }
28
+ it { expect { subject.teams }.to raise_error(SportsDataApi::Error) }
29
29
  end
30
30
 
31
31
  describe '.daily' do
32
- it { expect { subject.daily(2017, 1, 1) }.to raise_error(SportsDataApi::Exception) }
32
+ it { expect { subject.daily(2017, 1, 1) }.to raise_error(SportsDataApi::Error) }
33
33
  end
34
34
  end
35
35
 
@@ -42,23 +42,23 @@ describe SportsDataApi::Nhl, vcr: {
42
42
  before { stub_request(:any, /api\.sportradar\.us.*/).to_timeout }
43
43
 
44
44
  describe '.schedule' do
45
- it { expect { subject.schedule(2017, :REG) }.to raise_error(SportsDataApi::Exception) }
45
+ it { expect { subject.schedule(2017, :REG) }.to raise_error(SportsDataApi::Error) }
46
46
  end
47
47
 
48
48
  describe '.team_roster' do
49
- it { expect { subject.team_roster('team_uuid') }.to raise_error(SportsDataApi::Exception) }
49
+ it { expect { subject.team_roster('team_uuid') }.to raise_error(SportsDataApi::Error) }
50
50
  end
51
51
 
52
52
  describe '.game_summary' do
53
- it { expect { subject.game_summary('game_uuid') }.to raise_error(SportsDataApi::Exception) }
53
+ it { expect { subject.game_summary('game_uuid') }.to raise_error(SportsDataApi::Error) }
54
54
  end
55
55
 
56
56
  describe '.teams' do
57
- it { expect { subject.teams }.to raise_error(SportsDataApi::Exception) }
57
+ it { expect { subject.teams }.to raise_error(SportsDataApi::Error) }
58
58
  end
59
59
 
60
60
  describe '.daily' do
61
- it { expect { subject.daily(2017, 1, 1) }.to raise_error(SportsDataApi::Exception) }
61
+ it { expect { subject.daily(2017, 1, 1) }.to raise_error(SportsDataApi::Error) }
62
62
  end
63
63
  end
64
64
 
@@ -21,7 +21,7 @@ describe SportsDataApi do
21
21
  expect do
22
22
  SportsDataApi.generic_request('https://example.com', 'sport')
23
23
  end.to raise_error(
24
- SportsDataApi::Exception,
24
+ SportsDataApi::Error,
25
25
  'The API did not respond in a reasonable amount of time')
26
26
  end
27
27
  end
@@ -46,7 +46,7 @@ describe SportsDataApi do
46
46
 
47
47
  expect do
48
48
  SportsDataApi.generic_request('https://example.com', :sport)
49
- end.to raise_error(SportsDataApi::Exception, 'Server Error')
49
+ end.to raise_error(SportsDataApi::Error, 'Server Error')
50
50
 
51
51
  expect(RestClient).to have_received(:get)
52
52
  .with('https://example.com', { params: { api_key: 'key' } })
@@ -60,7 +60,7 @@ describe SportsDataApi do
60
60
 
61
61
  expect do
62
62
  SportsDataApi.generic_request('https://example.com', :sport)
63
- end.to raise_error(SportsDataApi::Exception, '527 Error')
63
+ end.to raise_error(SportsDataApi::Error, '527 Error')
64
64
 
65
65
  expect(RestClient).to have_received(:get)
66
66
  .with('https://example.com', { params: { api_key: 'key' } })
@@ -74,7 +74,7 @@ describe SportsDataApi do
74
74
 
75
75
  expect do
76
76
  SportsDataApi.generic_request('https://example.com', :sport)
77
- end.to raise_error(SportsDataApi::Exception, 'The server did not specify a message')
77
+ end.to raise_error(SportsDataApi::Error, 'The server did not specify a message')
78
78
 
79
79
  expect(RestClient).to have_received(:get)
80
80
  .with('https://example.com', { params: { api_key: 'key' } })
data/spec/spec_helper.rb CHANGED
@@ -39,6 +39,7 @@ RSpec.configure do |config|
39
39
  # the seed, which is printed after each run.
40
40
  # --seed 1234
41
41
  config.order = 'random'
42
+ config.example_status_persistence_file_path = 'tmp/specs.txt'
42
43
  end
43
44
 
44
45
  VCR.configure do |c|
@@ -24,7 +24,7 @@ Gem::Specification.new do |gem|
24
24
  gem.add_development_dependency 'pry'
25
25
  gem.add_development_dependency 'rake', '>= 11.0'
26
26
  gem.add_development_dependency 'rb-fsevent', '~> 0.9'
27
- gem.add_development_dependency 'rspec', '~> 3.5'
27
+ gem.add_development_dependency 'rspec', '~> 3.7'
28
28
  gem.add_development_dependency 'rspec-collection_matchers', '~> 1.1'
29
29
  gem.add_development_dependency 'rspec-its', '~> 1.2'
30
30
  gem.add_development_dependency 'rspec-xml', '~> 0.1'
data/tmp/.keep ADDED
File without changes
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.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Lovelett
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-10 00:00:00.000000000 Z
12
+ date: 2018-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -115,14 +115,14 @@ dependencies:
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '3.5'
118
+ version: '3.7'
119
119
  type: :development
120
120
  prerelease: false
121
121
  version_requirements: !ruby/object:Gem::Requirement
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '3.5'
125
+ version: '3.7'
126
126
  - !ruby/object:Gem::Dependency
127
127
  name: rspec-collection_matchers
128
128
  requirement: !ruby/object:Gem::Requirement
@@ -219,13 +219,14 @@ files:
219
219
  - ".gitignore"
220
220
  - ".rspec"
221
221
  - ".travis.yml"
222
+ - CHANGELOG.md
222
223
  - CODE_OF_CONDUCT.md
223
224
  - Gemfile
224
225
  - LICENSE.md
225
226
  - README.md
226
227
  - Rakefile
227
228
  - lib/sports_data_api.rb
228
- - lib/sports_data_api/exception.rb
229
+ - lib/sports_data_api/error.rb
229
230
  - lib/sports_data_api/golf.rb
230
231
  - lib/sports_data_api/golf/course.rb
231
232
  - lib/sports_data_api/golf/pairing.rb
@@ -486,6 +487,7 @@ files:
486
487
  - spec/lib/sports_data_api_spec.rb
487
488
  - spec/spec_helper.rb
488
489
  - sports_data_api.gemspec
490
+ - tmp/.keep
489
491
  homepage: https://github.com/RLovelett/sports_data_api
490
492
  licenses:
491
493
  - MIT
@@ -506,7 +508,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
506
508
  version: '0'
507
509
  requirements: []
508
510
  rubyforge_project:
509
- rubygems_version: 2.7.3
511
+ rubygems_version: 2.5.2
510
512
  signing_key:
511
513
  specification_version: 4
512
514
  summary: Sportradar’s comprehensive data coverage includes all major U.S. sports,
@@ -1,5 +0,0 @@
1
- module SportsDataApi
2
- class Exception < ::Exception
3
- # To change this template use File | Settings | File Templates.
4
- end
5
- end