chgk_rating 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.md +4 -4
- data/Rakefile +4 -2
- data/chgk_rating.gemspec +19 -12
- data/lib/chgk_rating/attribute_mappings.rb +107 -108
- data/lib/chgk_rating/chgk_object.rb +5 -1
- data/lib/chgk_rating/client.rb +4 -2
- data/lib/chgk_rating/collections/base.rb +20 -15
- data/lib/chgk_rating/collections/players.rb +3 -1
- data/lib/chgk_rating/collections/ratings/player_ratings.rb +3 -1
- data/lib/chgk_rating/collections/ratings/team_ratings.rb +3 -1
- data/lib/chgk_rating/collections/recaps.rb +4 -2
- data/lib/chgk_rating/collections/teams.rb +3 -1
- data/lib/chgk_rating/collections/tournaments/player_tournaments.rb +12 -8
- data/lib/chgk_rating/collections/tournaments/tournament_team_players.rb +3 -1
- data/lib/chgk_rating/collections/tournaments/tournament_team_results.rb +3 -1
- data/lib/chgk_rating/collections/tournaments/tournament_teams.rb +4 -1
- data/lib/chgk_rating/collections/tournaments/tournaments.rb +12 -8
- data/lib/chgk_rating/concerns/searching.rb +10 -9
- data/lib/chgk_rating/connection.rb +10 -8
- data/lib/chgk_rating/error.rb +7 -5
- data/lib/chgk_rating/models/base.rb +23 -16
- data/lib/chgk_rating/models/player.rb +3 -1
- data/lib/chgk_rating/models/rating/player_rating.rb +3 -1
- data/lib/chgk_rating/models/rating/rating.rb +3 -1
- data/lib/chgk_rating/models/rating/team_rating.rb +3 -1
- data/lib/chgk_rating/models/recap.rb +3 -1
- data/lib/chgk_rating/models/team.rb +3 -1
- data/lib/chgk_rating/models/tournament/player_tournament.rb +3 -1
- data/lib/chgk_rating/models/tournament/tournament.rb +3 -1
- data/lib/chgk_rating/models/tournament/tournament_team.rb +3 -1
- data/lib/chgk_rating/models/tournament/tournament_team_player.rb +3 -1
- data/lib/chgk_rating/models/tournament/tournament_team_result.rb +3 -1
- data/lib/chgk_rating/request.rb +10 -9
- data/lib/chgk_rating/utils/snakecase.rb +9 -7
- data/lib/chgk_rating/utils/transformations.rb +42 -36
- data/lib/chgk_rating/version.rb +4 -2
- data/lib/chgk_rating.rb +3 -1
- data/lib/ext/date.rb +6 -8
- data/lib/ext/date_time.rb +4 -2
- data/lib/ext/uri.rb +6 -6
- metadata +61 -80
- data/spec/lib/chgk_rating/client_spec.rb +0 -247
- data/spec/lib/chgk_rating/collections/player_ratings_spec.rb +0 -15
- data/spec/lib/chgk_rating/collections/players_spec.rb +0 -45
- data/spec/lib/chgk_rating/collections/recaps_spec.rb +0 -21
- data/spec/lib/chgk_rating/collections/team_ratings_spec.rb +0 -25
- data/spec/lib/chgk_rating/collections/teams_spec.rb +0 -42
- data/spec/lib/chgk_rating/collections/tournaments/player_tournaments_spec.rb +0 -38
- data/spec/lib/chgk_rating/collections/tournaments/tournament_team_players_spec.rb +0 -18
- data/spec/lib/chgk_rating/collections/tournaments/tournament_team_results_spec.rb +0 -17
- data/spec/lib/chgk_rating/collections/tournaments/tournament_teams_spec.rb +0 -58
- data/spec/lib/chgk_rating/collections/tournaments/tournaments_spec.rb +0 -62
- data/spec/lib/chgk_rating/models/base_spec.rb +0 -34
- data/spec/lib/chgk_rating/models/player_rating_spec.rb +0 -22
- data/spec/lib/chgk_rating/models/player_spec.rb +0 -62
- data/spec/lib/chgk_rating/models/recap_spec.rb +0 -35
- data/spec/lib/chgk_rating/models/team_rating_spec.rb +0 -27
- data/spec/lib/chgk_rating/models/team_spec.rb +0 -97
- data/spec/lib/chgk_rating/models/tournament/tournament_spec.rb +0 -95
- data/spec/lib/chgk_rating/models/tournament/tournament_team_player_spec.rb +0 -21
- data/spec/lib/chgk_rating/models/tournament/tournament_team_result_spec.rb +0 -19
- data/spec/lib/chgk_rating/models/tournament/tournament_team_spec.rb +0 -36
- data/spec/lib/chgk_rating/utils/snakecase_spec.rb +0 -12
- data/spec/lib/chgk_rating/utils/transformations_spec.rb +0 -16
- data/spec/lib/chgk_rating_spec.rb +0 -5
- data/spec/lib/ext/date_spec.rb +0 -7
- data/spec/lib/ext/date_time_spec.rb +0 -11
- data/spec/lib/ext/uri_spec.rb +0 -7
- data/spec/spec_helper.rb +0 -15
- data/spec/support/shared_examples.rb +0 -63
- data/spec/support/test_client.rb +0 -6
- data/spec/support/vcr.rb +0 -11
data/spec/spec_helper.rb
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
SimpleCov.start do
|
3
|
-
add_filter "spec/"
|
4
|
-
add_filter ".github/"
|
5
|
-
add_filter "docs/"
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'chgk_rating'
|
9
|
-
|
10
|
-
# Support files
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
|
-
|
13
|
-
RSpec.configure do |config|
|
14
|
-
config.include TestClient
|
15
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
RSpec.shared_examples_for 'an array' do
|
2
|
-
it { is_expected.to respond_to :to_a }
|
3
|
-
end
|
4
|
-
|
5
|
-
RSpec.shared_examples_for 'not a hash' do
|
6
|
-
it { is_expected.not_to respond_to :to_h }
|
7
|
-
it { expect( -> {subject.to_h} ).to raise_error(ChgkRating::Error::NotHashType).
|
8
|
-
with_message('This is not a hash-like collection, so it cannot be converted to an ordinary hash.')}
|
9
|
-
end
|
10
|
-
|
11
|
-
RSpec.shared_examples_for 'not an array' do
|
12
|
-
it { is_expected.not_to respond_to :to_a }
|
13
|
-
it { expect( -> {subject.to_a} ).to raise_error(ChgkRating::Error::NotArrayType).
|
14
|
-
with_message('This is not an array-like collection, so it cannot be converted to an ordinary array.')}
|
15
|
-
end
|
16
|
-
|
17
|
-
RSpec.shared_examples_for 'a hash' do
|
18
|
-
it { is_expected.to respond_to :to_h }
|
19
|
-
end
|
20
|
-
|
21
|
-
RSpec.shared_examples_for 'tournament team player' do
|
22
|
-
specify('#id') { expect(player.id).to eq '51249' }
|
23
|
-
specify('#is_captain') { expect(player.is_captain).to eq true }
|
24
|
-
specify('#is_base') { expect(player.is_base).to eq true }
|
25
|
-
specify('#is_foreign') { expect(player.is_foreign).to eq false }
|
26
|
-
end
|
27
|
-
|
28
|
-
RSpec.shared_examples_for 'tournament team result' do
|
29
|
-
specify('#result') { expect(team_result.result).to eq [false, false, false, false, true, true,
|
30
|
-
true, false, false, true, false, false] }
|
31
|
-
specify('#tour') { expect(team_result.tour).to eq 1 }
|
32
|
-
end
|
33
|
-
|
34
|
-
RSpec.shared_examples_for 'model without eager loading' do
|
35
|
-
it 'should raise an EagerLoadingNotSupported error' do
|
36
|
-
expect( -> { subject.eager_load! }).to raise_error(ChgkRating::Error::EagerLoadingNotSupported).
|
37
|
-
with_message 'Eager loading is not supported for this resource.'
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
RSpec.shared_examples_for 'model with eager loading' do
|
42
|
-
it 'should not raise an EagerLoadingNotSupported error' do
|
43
|
-
expect( -> { subject.eager_load! }).not_to raise_error
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
RSpec.shared_examples_for 'model without lazy support' do
|
48
|
-
it { is_expected.not_to respond_to(:lazy) }
|
49
|
-
|
50
|
-
it 'should define NO_LAZY_SUPPORT constant' do
|
51
|
-
expect(subject.class::NO_LAZY_SUPPORT).to eq true
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
RSpec.shared_examples_for 'model with lazy support' do
|
56
|
-
it { is_expected.to respond_to(:lazy) }
|
57
|
-
|
58
|
-
it 'should not define NO_LAZY_SUPPORT constant' do
|
59
|
-
klass = subject.class
|
60
|
-
expect( -> { klass::NO_LAZY_SUPPORT }).to raise_error(NameError).
|
61
|
-
with_message "uninitialized constant #{klass}::NO_LAZY_SUPPORT"
|
62
|
-
end
|
63
|
-
end
|
data/spec/support/test_client.rb
DELETED
data/spec/support/vcr.rb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
require 'vcr'
|
2
|
-
|
3
|
-
VCR.configure do |c|
|
4
|
-
c.allow_http_connections_when_no_cassette = true
|
5
|
-
c.ignore_hosts 'codeclimate.com'
|
6
|
-
c.hook_into :faraday
|
7
|
-
c.cassette_library_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'vcr_cassettes')
|
8
|
-
c.before_record do |i|
|
9
|
-
i.response.body.force_encoding("UTF-8")
|
10
|
-
end
|
11
|
-
end
|