chgk_rating 1.0.0.rc1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE.md +12 -12
  3. data/.github/PULL_REQUEST_TEMPLATE.md +10 -10
  4. data/CHANGELOG.md +7 -0
  5. data/Gemfile +2 -6
  6. data/LICENSE +21 -21
  7. data/README.md +2 -1
  8. data/Rakefile +12 -12
  9. data/chgk_rating.gemspec +28 -28
  10. data/lib/chgk_rating.rb +51 -52
  11. data/lib/chgk_rating/attribute_mappings.rb +138 -137
  12. data/lib/chgk_rating/chgk_object.rb +12 -12
  13. data/lib/chgk_rating/client.rb +172 -172
  14. data/lib/chgk_rating/collections/base.rb +78 -78
  15. data/lib/chgk_rating/collections/players.rb +16 -16
  16. data/lib/chgk_rating/collections/ratings.rb +22 -22
  17. data/lib/chgk_rating/collections/recaps.rb +24 -24
  18. data/lib/chgk_rating/collections/teams.rb +16 -16
  19. data/lib/chgk_rating/collections/tournament_players.rb +23 -23
  20. data/lib/chgk_rating/collections/tournament_team_results.rb +23 -23
  21. data/lib/chgk_rating/collections/tournament_teams.rb +21 -21
  22. data/lib/chgk_rating/collections/tournaments.rb +46 -46
  23. data/lib/chgk_rating/concerns/searching.rb +24 -20
  24. data/lib/chgk_rating/connection.rb +18 -18
  25. data/lib/chgk_rating/error.rb +45 -45
  26. data/lib/chgk_rating/models/base.rb +89 -89
  27. data/lib/chgk_rating/models/player.rb +10 -10
  28. data/lib/chgk_rating/models/rating.rb +18 -18
  29. data/lib/chgk_rating/models/recap.rb +18 -18
  30. data/lib/chgk_rating/models/team.rb +61 -61
  31. data/lib/chgk_rating/models/tournament.rb +45 -45
  32. data/lib/chgk_rating/models/tournament_player.rb +7 -7
  33. data/lib/chgk_rating/models/tournament_team.rb +28 -28
  34. data/lib/chgk_rating/models/tournament_team_result.rb +7 -7
  35. data/lib/chgk_rating/request.rb +31 -31
  36. data/lib/chgk_rating/utils/snakecase.rb +15 -15
  37. data/lib/chgk_rating/utils/transformations.rb +82 -82
  38. data/lib/chgk_rating/version.rb +2 -2
  39. data/lib/ext/date.rb +10 -10
  40. data/lib/ext/date_time.rb +4 -4
  41. data/lib/ext/uri.rb +8 -8
  42. data/spec/lib/chgk_rating/client_spec.rb +207 -197
  43. data/spec/lib/chgk_rating/collections/players_spec.rb +44 -44
  44. data/spec/lib/chgk_rating/collections/ratings_spec.rb +24 -24
  45. data/spec/lib/chgk_rating/collections/recaps_spec.rb +20 -20
  46. data/spec/lib/chgk_rating/collections/teams_spec.rb +41 -41
  47. data/spec/lib/chgk_rating/collections/tournament_players_spec.rb +17 -17
  48. data/spec/lib/chgk_rating/collections/tournament_team_results_spec.rb +16 -16
  49. data/spec/lib/chgk_rating/collections/tournament_teams_spec.rb +59 -57
  50. data/spec/lib/chgk_rating/collections/tournaments_spec.rb +61 -61
  51. data/spec/lib/chgk_rating/models/base_spec.rb +33 -33
  52. data/spec/lib/chgk_rating/models/player_spec.rb +34 -34
  53. data/spec/lib/chgk_rating/models/rating_spec.rb +26 -26
  54. data/spec/lib/chgk_rating/models/recap_spec.rb +34 -34
  55. data/spec/lib/chgk_rating/models/team_spec.rb +88 -88
  56. data/spec/lib/chgk_rating/models/tournament_player_spec.rb +20 -20
  57. data/spec/lib/chgk_rating/models/tournament_spec.rb +91 -91
  58. data/spec/lib/chgk_rating/models/tournament_team_result_spec.rb +18 -18
  59. data/spec/lib/chgk_rating/models/tournament_team_spec.rb +35 -35
  60. data/spec/lib/chgk_rating/utils/snakecase_spec.rb +11 -11
  61. data/spec/lib/chgk_rating/utils/transformations_spec.rb +15 -15
  62. data/spec/lib/chgk_rating_spec.rb +4 -4
  63. data/spec/lib/ext/date_spec.rb +6 -6
  64. data/spec/lib/ext/date_time_spec.rb +10 -10
  65. data/spec/lib/ext/uri_spec.rb +6 -6
  66. data/spec/spec_helper.rb +12 -12
  67. data/spec/support/shared_examples.rb +62 -62
  68. data/spec/support/test_client.rb +5 -5
  69. data/spec/support/vcr.rb +10 -9
  70. metadata +5 -5
data/spec/spec_helper.rb CHANGED
@@ -1,13 +1,13 @@
1
- require 'simplecov'
2
- SimpleCov.start do
3
- add_filter "spec/"
4
- end
5
-
6
- require 'chgk_rating'
7
-
8
- # Support files
9
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
10
-
11
- RSpec.configure do |config|
12
- config.include TestClient
1
+ require 'simplecov'
2
+ SimpleCov.start do
3
+ add_filter "spec/"
4
+ end
5
+
6
+ require 'chgk_rating'
7
+
8
+ # Support files
9
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
10
+
11
+ RSpec.configure do |config|
12
+ config.include TestClient
13
13
  end
@@ -1,63 +1,63 @@
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
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
63
  end
@@ -1,6 +1,6 @@
1
- module TestClient
2
- def test_client
3
- return @client if @client
4
- @client = ChgkRating.client
5
- end
1
+ module TestClient
2
+ def test_client
3
+ return @client if @client
4
+ @client = ChgkRating.client
5
+ end
6
6
  end
data/spec/support/vcr.rb CHANGED
@@ -1,10 +1,11 @@
1
- require 'vcr'
2
-
3
- VCR.configure do |c|
4
- c.ignore_hosts 'codeclimate.com'
5
- c.hook_into :faraday
6
- c.cassette_library_dir = File.join(File.dirname(__FILE__), '..', 'fixtures', 'vcr_cassettes')
7
- c.before_record do |i|
8
- i.response.body.force_encoding("UTF-8")
9
- end
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
10
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chgk_rating
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Bodrov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-22 00:00:00.000000000 Z
11
+ date: 2018-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -173,7 +173,7 @@ files:
173
173
  - spec/support/shared_examples.rb
174
174
  - spec/support/test_client.rb
175
175
  - spec/support/vcr.rb
176
- homepage: https://github.com/bodrovis/chgk_rating
176
+ homepage: https://github.com/bodrovis/ChgkRating
177
177
  licenses:
178
178
  - MIT
179
179
  metadata: {}
@@ -188,9 +188,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
188
  version: 2.4.0
189
189
  required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  requirements:
191
- - - ">"
191
+ - - ">="
192
192
  - !ruby/object:Gem::Version
193
- version: 1.3.1
193
+ version: '0'
194
194
  requirements: []
195
195
  rubyforge_project:
196
196
  rubygems_version: 2.7.6