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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/Gemfile +3 -1
  4. data/LICENSE +1 -1
  5. data/README.md +4 -4
  6. data/Rakefile +4 -2
  7. data/chgk_rating.gemspec +19 -12
  8. data/lib/chgk_rating/attribute_mappings.rb +107 -108
  9. data/lib/chgk_rating/chgk_object.rb +5 -1
  10. data/lib/chgk_rating/client.rb +4 -2
  11. data/lib/chgk_rating/collections/base.rb +20 -15
  12. data/lib/chgk_rating/collections/players.rb +3 -1
  13. data/lib/chgk_rating/collections/ratings/player_ratings.rb +3 -1
  14. data/lib/chgk_rating/collections/ratings/team_ratings.rb +3 -1
  15. data/lib/chgk_rating/collections/recaps.rb +4 -2
  16. data/lib/chgk_rating/collections/teams.rb +3 -1
  17. data/lib/chgk_rating/collections/tournaments/player_tournaments.rb +12 -8
  18. data/lib/chgk_rating/collections/tournaments/tournament_team_players.rb +3 -1
  19. data/lib/chgk_rating/collections/tournaments/tournament_team_results.rb +3 -1
  20. data/lib/chgk_rating/collections/tournaments/tournament_teams.rb +4 -1
  21. data/lib/chgk_rating/collections/tournaments/tournaments.rb +12 -8
  22. data/lib/chgk_rating/concerns/searching.rb +10 -9
  23. data/lib/chgk_rating/connection.rb +10 -8
  24. data/lib/chgk_rating/error.rb +7 -5
  25. data/lib/chgk_rating/models/base.rb +23 -16
  26. data/lib/chgk_rating/models/player.rb +3 -1
  27. data/lib/chgk_rating/models/rating/player_rating.rb +3 -1
  28. data/lib/chgk_rating/models/rating/rating.rb +3 -1
  29. data/lib/chgk_rating/models/rating/team_rating.rb +3 -1
  30. data/lib/chgk_rating/models/recap.rb +3 -1
  31. data/lib/chgk_rating/models/team.rb +3 -1
  32. data/lib/chgk_rating/models/tournament/player_tournament.rb +3 -1
  33. data/lib/chgk_rating/models/tournament/tournament.rb +3 -1
  34. data/lib/chgk_rating/models/tournament/tournament_team.rb +3 -1
  35. data/lib/chgk_rating/models/tournament/tournament_team_player.rb +3 -1
  36. data/lib/chgk_rating/models/tournament/tournament_team_result.rb +3 -1
  37. data/lib/chgk_rating/request.rb +10 -9
  38. data/lib/chgk_rating/utils/snakecase.rb +9 -7
  39. data/lib/chgk_rating/utils/transformations.rb +42 -36
  40. data/lib/chgk_rating/version.rb +4 -2
  41. data/lib/chgk_rating.rb +3 -1
  42. data/lib/ext/date.rb +6 -8
  43. data/lib/ext/date_time.rb +4 -2
  44. data/lib/ext/uri.rb +6 -6
  45. metadata +61 -80
  46. data/spec/lib/chgk_rating/client_spec.rb +0 -247
  47. data/spec/lib/chgk_rating/collections/player_ratings_spec.rb +0 -15
  48. data/spec/lib/chgk_rating/collections/players_spec.rb +0 -45
  49. data/spec/lib/chgk_rating/collections/recaps_spec.rb +0 -21
  50. data/spec/lib/chgk_rating/collections/team_ratings_spec.rb +0 -25
  51. data/spec/lib/chgk_rating/collections/teams_spec.rb +0 -42
  52. data/spec/lib/chgk_rating/collections/tournaments/player_tournaments_spec.rb +0 -38
  53. data/spec/lib/chgk_rating/collections/tournaments/tournament_team_players_spec.rb +0 -18
  54. data/spec/lib/chgk_rating/collections/tournaments/tournament_team_results_spec.rb +0 -17
  55. data/spec/lib/chgk_rating/collections/tournaments/tournament_teams_spec.rb +0 -58
  56. data/spec/lib/chgk_rating/collections/tournaments/tournaments_spec.rb +0 -62
  57. data/spec/lib/chgk_rating/models/base_spec.rb +0 -34
  58. data/spec/lib/chgk_rating/models/player_rating_spec.rb +0 -22
  59. data/spec/lib/chgk_rating/models/player_spec.rb +0 -62
  60. data/spec/lib/chgk_rating/models/recap_spec.rb +0 -35
  61. data/spec/lib/chgk_rating/models/team_rating_spec.rb +0 -27
  62. data/spec/lib/chgk_rating/models/team_spec.rb +0 -97
  63. data/spec/lib/chgk_rating/models/tournament/tournament_spec.rb +0 -95
  64. data/spec/lib/chgk_rating/models/tournament/tournament_team_player_spec.rb +0 -21
  65. data/spec/lib/chgk_rating/models/tournament/tournament_team_result_spec.rb +0 -19
  66. data/spec/lib/chgk_rating/models/tournament/tournament_team_spec.rb +0 -36
  67. data/spec/lib/chgk_rating/utils/snakecase_spec.rb +0 -12
  68. data/spec/lib/chgk_rating/utils/transformations_spec.rb +0 -16
  69. data/spec/lib/chgk_rating_spec.rb +0 -5
  70. data/spec/lib/ext/date_spec.rb +0 -7
  71. data/spec/lib/ext/date_time_spec.rb +0 -11
  72. data/spec/lib/ext/uri_spec.rb +0 -7
  73. data/spec/spec_helper.rb +0 -15
  74. data/spec/support/shared_examples.rb +0 -63
  75. data/spec/support/test_client.rb +0 -6
  76. 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
@@ -1,6 +0,0 @@
1
- module TestClient
2
- def test_client
3
- return @client if @client
4
- @client = ChgkRating.client
5
- end
6
- end
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