sports_data_api 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -0
- data/README.md +1 -1
- data/lib/sports_data_api/nba/game.rb +10 -2
- data/lib/sports_data_api/ncaafb.rb +8 -0
- data/lib/sports_data_api/ncaafb/team_roster.rb +14 -0
- data/lib/sports_data_api/version.rb +1 -1
- data/spec/cassettes/sports_data_api_ncaafb.yml +2848 -0
- data/spec/cassettes/sports_data_api_ncaafb_team_roster.yml +715 -0
- data/spec/lib/sports_data_api/nba/game_spec.rb +42 -0
- data/spec/lib/sports_data_api/ncaafb/team_roster_spec.rb +48 -0
- data/spec/lib/sports_data_api/ncaafb_spec.rb +13 -0
- data/spec/spec_helper.rb +7 -5
- data/sports_data_api.gemspec +2 -2
- metadata +10 -5
@@ -30,6 +30,20 @@ describe SportsDataApi::Nba::Game, vcr: {
|
|
30
30
|
its(:status) { should eq 'closed' }
|
31
31
|
its(:home_team) { should be_an_instance_of(SportsDataApi::Nba::Team) }
|
32
32
|
its(:away_team) { should be_an_instance_of(SportsDataApi::Nba::Team) }
|
33
|
+
describe 'parsing team info' do
|
34
|
+
it 'home team should have an name' do
|
35
|
+
subject.home_team.name.should eq 'Indiana Pacers'
|
36
|
+
end
|
37
|
+
it 'away team should have an name' do
|
38
|
+
subject.away_team.name.should eq 'Orlando Magic'
|
39
|
+
end
|
40
|
+
it 'home team should have an alias' do
|
41
|
+
subject.home_team.alias.should eq 'IND'
|
42
|
+
end
|
43
|
+
it 'away team should have an alias' do
|
44
|
+
subject.away_team.alias.should eq 'ORL'
|
45
|
+
end
|
46
|
+
end
|
33
47
|
its(:venue) { should be_an_instance_of(SportsDataApi::Nba::Venue) }
|
34
48
|
its(:broadcast) { should be_an_instance_of(SportsDataApi::Nba::Broadcast) }
|
35
49
|
its(:summary) { should be_an_instance_of(SportsDataApi::Nba::Game) }
|
@@ -52,6 +66,20 @@ describe SportsDataApi::Nba::Game, vcr: {
|
|
52
66
|
its(:clock) { should eq '00:00' }
|
53
67
|
its(:home_team) { should be_an_instance_of(SportsDataApi::Nba::Team) }
|
54
68
|
its(:away_team) { should be_an_instance_of(SportsDataApi::Nba::Team) }
|
69
|
+
describe 'parsing team info' do
|
70
|
+
it 'home team should have an name' do
|
71
|
+
subject.home_team.name.should eq 'Warriors'
|
72
|
+
end
|
73
|
+
it 'away team should have an name' do
|
74
|
+
subject.away_team.name.should eq 'Lakers'
|
75
|
+
end
|
76
|
+
it 'home team should have an market' do
|
77
|
+
subject.home_team.market.should eq 'Golden State'
|
78
|
+
end
|
79
|
+
it 'away team should have an market' do
|
80
|
+
subject.away_team.market.should eq 'Los Angeles'
|
81
|
+
end
|
82
|
+
end
|
55
83
|
its(:venue) { should be_an_instance_of(SportsDataApi::Nba::Venue) }
|
56
84
|
its(:broadcast) { should be_an_instance_of(SportsDataApi::Nba::Broadcast) }
|
57
85
|
its(:summary) { should be_an_instance_of(SportsDataApi::Nba::Game) }
|
@@ -74,6 +102,20 @@ describe SportsDataApi::Nba::Game, vcr: {
|
|
74
102
|
its(:clock) { should eq nil }
|
75
103
|
its(:home_team) { should be_an_instance_of(SportsDataApi::Nba::Team) }
|
76
104
|
its(:away_team) { should be_an_instance_of(SportsDataApi::Nba::Team) }
|
105
|
+
describe 'parsing team info' do
|
106
|
+
it 'home team should have an name' do
|
107
|
+
subject.home_team.name.should eq 'Brooklyn Nets'
|
108
|
+
end
|
109
|
+
it 'away team should have an name' do
|
110
|
+
subject.away_team.name.should eq 'Los Angeles Clippers'
|
111
|
+
end
|
112
|
+
it 'home team should have an alias' do
|
113
|
+
subject.home_team.alias.should eq 'BKN'
|
114
|
+
end
|
115
|
+
it 'away team should have an alias' do
|
116
|
+
subject.away_team.alias.should eq 'LAC'
|
117
|
+
end
|
118
|
+
end
|
77
119
|
its(:venue) { should be_an_instance_of(SportsDataApi::Nba::Venue) }
|
78
120
|
its(:broadcast) { should be_an_instance_of(SportsDataApi::Nba::Broadcast) }
|
79
121
|
its(:summary) { should be_an_instance_of(SportsDataApi::Nba::Game) }
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SportsDataApi::Ncaafb::TeamRoster, vcr: {
|
4
|
+
cassette_name: 'sports_data_api_ncaafb_team_roster',
|
5
|
+
record: :new_episodes,
|
6
|
+
match_requests_on: [:host, :path]
|
7
|
+
} do
|
8
|
+
before do
|
9
|
+
SportsDataApi.set_key(:ncaafb, api_key(:ncaafb))
|
10
|
+
SportsDataApi.set_access_level(:ncaafb, 't')
|
11
|
+
end
|
12
|
+
let(:roster) { SportsDataApi::Ncaafb.team_roster('WIS').players.first }
|
13
|
+
|
14
|
+
describe 'player' do
|
15
|
+
it 'responds to id attribute' do
|
16
|
+
expect(roster.player.has_key?(:id)).to be true
|
17
|
+
expect(roster.player[:id]).not_to be nil
|
18
|
+
end
|
19
|
+
it 'responds to position attribute' do
|
20
|
+
expect(roster.player.has_key?(:position)).to be true
|
21
|
+
expect(roster.player[:position]).not_to be nil
|
22
|
+
end
|
23
|
+
it 'responds to status attribute' do
|
24
|
+
expect(roster.player.has_key?(:status)).to be true
|
25
|
+
expect(roster.player[:status]).not_to be nil
|
26
|
+
end
|
27
|
+
it 'responds to name_first attribute' do
|
28
|
+
expect(roster.player.has_key?(:name_first)).to be true
|
29
|
+
expect(roster.player[:name_first]).not_to be nil
|
30
|
+
end
|
31
|
+
it 'responds to name_last attribute' do
|
32
|
+
expect(roster.player.has_key?(:name_last)).to be true
|
33
|
+
expect(roster.player[:name_last]).not_to be nil
|
34
|
+
end
|
35
|
+
it 'responds to name_full attribute' do
|
36
|
+
expect(roster.player.has_key?(:name_full)).to be true
|
37
|
+
expect(roster.player[:name_full]).not_to be nil
|
38
|
+
end
|
39
|
+
it 'responds to height attribute' do
|
40
|
+
expect(roster.player.has_key?(:height)).to be true
|
41
|
+
expect(roster.player[:height]).not_to be nil
|
42
|
+
end
|
43
|
+
it 'responds to weight attribute' do
|
44
|
+
expect(roster.player.has_key?(:weight)).to be true
|
45
|
+
expect(roster.player[:weight]).not_to be nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -44,4 +44,17 @@ describe SportsDataApi::Ncaafb, vcr: {
|
|
44
44
|
it { expect { subject.weekly(2014, :REG, 22) }.to raise_error(SportsDataApi::Exception) }
|
45
45
|
end
|
46
46
|
end
|
47
|
+
|
48
|
+
describe 'team based class methods' do
|
49
|
+
before do
|
50
|
+
SportsDataApi.set_key(:ncaafb, api_key(:ncaafb))
|
51
|
+
SportsDataApi.set_access_level(:ncaafb, 't')
|
52
|
+
end
|
53
|
+
|
54
|
+
context '#team_roster' do
|
55
|
+
it 'returns an array' do
|
56
|
+
expect(subject.team_roster('WIS').players.kind_of?(Array)).to be true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
47
60
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,10 @@
|
|
1
1
|
require 'simplecov'
|
2
|
-
require 'coveralls'
|
3
2
|
require 'pry'
|
4
|
-
|
5
|
-
Coveralls::SimpleCov::Formatter,
|
6
|
-
SimpleCov::Formatter::HTMLFormatter
|
7
|
-
]
|
3
|
+
require 'codeclimate-test-reporter'
|
8
4
|
SimpleCov.start do
|
9
5
|
add_filter "/spec/"
|
10
6
|
end
|
7
|
+
CodeClimate::TestReporter.start
|
11
8
|
|
12
9
|
# Previous content of test helper now starts here
|
13
10
|
require "sports_data_api"
|
@@ -47,6 +44,11 @@ VCR.configure do |c|
|
|
47
44
|
c.preserve_exact_body_bytes { true }
|
48
45
|
c.configure_rspec_metadata!
|
49
46
|
|
47
|
+
# VCR will prevent the codeclimate-test-reporter from reporting results to
|
48
|
+
# codeclimate.com. Configure VCR to ignore the codeclimate.com hostname to
|
49
|
+
# ensure codeclimate-test-reporter can post coverage results.
|
50
|
+
c.ignore_hosts 'codeclimate.com'
|
51
|
+
|
50
52
|
##
|
51
53
|
# Filter the real API key so that it does not make its way into the VCR cassette
|
52
54
|
c.filter_sensitive_data('<API_KEY>') { api_key(:nfl) }
|
data/sports_data_api.gemspec
CHANGED
@@ -29,6 +29,6 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_development_dependency 'vcr', '~> 2.4.0'
|
30
30
|
gem.add_development_dependency 'webmock', '~> 1.9.0'
|
31
31
|
gem.add_development_dependency 'faker', '~> 1.1.2'
|
32
|
-
gem.add_development_dependency 'simplecov', '~> 0.
|
33
|
-
gem.add_development_dependency '
|
32
|
+
gem.add_development_dependency 'simplecov', '~> 0.11.0'
|
33
|
+
gem.add_development_dependency 'codeclimate-test-reporter'
|
34
34
|
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.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-12-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -199,16 +199,16 @@ dependencies:
|
|
199
199
|
requirements:
|
200
200
|
- - "~>"
|
201
201
|
- !ruby/object:Gem::Version
|
202
|
-
version: 0.
|
202
|
+
version: 0.11.0
|
203
203
|
type: :development
|
204
204
|
prerelease: false
|
205
205
|
version_requirements: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
207
|
- - "~>"
|
208
208
|
- !ruby/object:Gem::Version
|
209
|
-
version: 0.
|
209
|
+
version: 0.11.0
|
210
210
|
- !ruby/object:Gem::Dependency
|
211
|
-
name:
|
211
|
+
name: codeclimate-test-reporter
|
212
212
|
requirement: !ruby/object:Gem::Requirement
|
213
213
|
requirements:
|
214
214
|
- - ">="
|
@@ -274,6 +274,7 @@ files:
|
|
274
274
|
- lib/sports_data_api/ncaafb/polls.rb
|
275
275
|
- lib/sports_data_api/ncaafb/season.rb
|
276
276
|
- lib/sports_data_api/ncaafb/team.rb
|
277
|
+
- lib/sports_data_api/ncaafb/team_roster.rb
|
277
278
|
- lib/sports_data_api/ncaafb/teams.rb
|
278
279
|
- lib/sports_data_api/ncaafb/venue.rb
|
279
280
|
- lib/sports_data_api/ncaafb/weather.rb
|
@@ -345,6 +346,7 @@ files:
|
|
345
346
|
- spec/cassettes/sports_data_api_ncaafb_season.yml
|
346
347
|
- spec/cassettes/sports_data_api_ncaafb_team.yml
|
347
348
|
- spec/cassettes/sports_data_api_ncaafb_team_hierarchy.yml
|
349
|
+
- spec/cassettes/sports_data_api_ncaafb_team_roster.yml
|
348
350
|
- spec/cassettes/sports_data_api_ncaafb_venue.yml
|
349
351
|
- spec/cassettes/sports_data_api_ncaafb_weather.yml
|
350
352
|
- spec/cassettes/sports_data_api_ncaamb.yml
|
@@ -407,6 +409,7 @@ files:
|
|
407
409
|
- spec/lib/sports_data_api/ncaafb/poll_team_spec.rb
|
408
410
|
- spec/lib/sports_data_api/ncaafb/polls_spec.rb
|
409
411
|
- spec/lib/sports_data_api/ncaafb/season_spec.rb
|
412
|
+
- spec/lib/sports_data_api/ncaafb/team_roster_spec.rb
|
410
413
|
- spec/lib/sports_data_api/ncaafb/team_spec.rb
|
411
414
|
- spec/lib/sports_data_api/ncaafb/teams_spec.rb
|
412
415
|
- spec/lib/sports_data_api/ncaafb/venue_spec.rb
|
@@ -506,6 +509,7 @@ test_files:
|
|
506
509
|
- spec/cassettes/sports_data_api_ncaafb_season.yml
|
507
510
|
- spec/cassettes/sports_data_api_ncaafb_team.yml
|
508
511
|
- spec/cassettes/sports_data_api_ncaafb_team_hierarchy.yml
|
512
|
+
- spec/cassettes/sports_data_api_ncaafb_team_roster.yml
|
509
513
|
- spec/cassettes/sports_data_api_ncaafb_venue.yml
|
510
514
|
- spec/cassettes/sports_data_api_ncaafb_weather.yml
|
511
515
|
- spec/cassettes/sports_data_api_ncaamb.yml
|
@@ -568,6 +572,7 @@ test_files:
|
|
568
572
|
- spec/lib/sports_data_api/ncaafb/poll_team_spec.rb
|
569
573
|
- spec/lib/sports_data_api/ncaafb/polls_spec.rb
|
570
574
|
- spec/lib/sports_data_api/ncaafb/season_spec.rb
|
575
|
+
- spec/lib/sports_data_api/ncaafb/team_roster_spec.rb
|
571
576
|
- spec/lib/sports_data_api/ncaafb/team_spec.rb
|
572
577
|
- spec/lib/sports_data_api/ncaafb/teams_spec.rb
|
573
578
|
- spec/lib/sports_data_api/ncaafb/venue_spec.rb
|