chgk_rating 2.0.0 → 2.2.1

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 +17 -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 +108 -97
  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 +43 -37
  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 -60
  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 -89
  63. data/spec/lib/chgk_rating/models/tournament/tournament_spec.rb +0 -92
  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
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: 2.0.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
- - Ilya Bodrov
7
+ - Ilya Krukowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-28 00:00:00.000000000 Z
11
+ date: 2022-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.8'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: faraday_middleware
28
+ name: faraday-follow_redirects
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.2'
33
+ version: '0.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.2'
40
+ version: '0.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: multi_json
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.15'
55
+ - !ruby/object:Gem::Dependency
56
+ name: codecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.1'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -81,33 +95,61 @@ dependencies:
81
95
  - !ruby/object:Gem::Version
82
96
  version: '3.6'
83
97
  - !ruby/object:Gem::Dependency
84
- name: vcr
98
+ name: rubocop
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '6.0'
103
+ version: '1.31'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '6.0'
110
+ version: '1.31'
97
111
  - !ruby/object:Gem::Dependency
98
- name: codeclimate-test-reporter
112
+ name: rubocop-performance
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '1.0'
117
+ version: '1.5'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '1.0'
124
+ version: '1.5'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-rspec
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '2.11'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '2.11'
139
+ - !ruby/object:Gem::Dependency
140
+ name: vcr
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '6.0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '6.0'
111
153
  description: Opinionated Ruby client for the competitive What? Where? When? rating
112
154
  WebAPI (rating.chgk.info) that allows to work with data as with Ruby objects
113
155
  email:
@@ -164,41 +206,11 @@ files:
164
206
  - lib/ext/date.rb
165
207
  - lib/ext/date_time.rb
166
208
  - lib/ext/uri.rb
167
- - spec/lib/chgk_rating/client_spec.rb
168
- - spec/lib/chgk_rating/collections/player_ratings_spec.rb
169
- - spec/lib/chgk_rating/collections/players_spec.rb
170
- - spec/lib/chgk_rating/collections/recaps_spec.rb
171
- - spec/lib/chgk_rating/collections/team_ratings_spec.rb
172
- - spec/lib/chgk_rating/collections/teams_spec.rb
173
- - spec/lib/chgk_rating/collections/tournaments/player_tournaments_spec.rb
174
- - spec/lib/chgk_rating/collections/tournaments/tournament_team_players_spec.rb
175
- - spec/lib/chgk_rating/collections/tournaments/tournament_team_results_spec.rb
176
- - spec/lib/chgk_rating/collections/tournaments/tournament_teams_spec.rb
177
- - spec/lib/chgk_rating/collections/tournaments/tournaments_spec.rb
178
- - spec/lib/chgk_rating/models/base_spec.rb
179
- - spec/lib/chgk_rating/models/player_rating_spec.rb
180
- - spec/lib/chgk_rating/models/player_spec.rb
181
- - spec/lib/chgk_rating/models/recap_spec.rb
182
- - spec/lib/chgk_rating/models/team_rating_spec.rb
183
- - spec/lib/chgk_rating/models/team_spec.rb
184
- - spec/lib/chgk_rating/models/tournament/tournament_spec.rb
185
- - spec/lib/chgk_rating/models/tournament/tournament_team_player_spec.rb
186
- - spec/lib/chgk_rating/models/tournament/tournament_team_result_spec.rb
187
- - spec/lib/chgk_rating/models/tournament/tournament_team_spec.rb
188
- - spec/lib/chgk_rating/utils/snakecase_spec.rb
189
- - spec/lib/chgk_rating/utils/transformations_spec.rb
190
- - spec/lib/chgk_rating_spec.rb
191
- - spec/lib/ext/date_spec.rb
192
- - spec/lib/ext/date_time_spec.rb
193
- - spec/lib/ext/uri_spec.rb
194
- - spec/spec_helper.rb
195
- - spec/support/shared_examples.rb
196
- - spec/support/test_client.rb
197
- - spec/support/vcr.rb
198
209
  homepage: http://chgk-rating.bodrovis.tech/
199
210
  licenses:
200
211
  - MIT
201
- metadata: {}
212
+ metadata:
213
+ rubygems_mfa_required: 'true'
202
214
  post_install_message:
203
215
  rdoc_options: []
204
216
  require_paths:
@@ -207,46 +219,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
219
  requirements:
208
220
  - - ">="
209
221
  - !ruby/object:Gem::Version
210
- version: 2.4.0
222
+ version: 2.6.0
211
223
  required_rubygems_version: !ruby/object:Gem::Requirement
212
224
  requirements:
213
225
  - - ">="
214
226
  - !ruby/object:Gem::Version
215
227
  version: '0'
216
228
  requirements: []
217
- rubygems_version: 3.2.33
229
+ rubygems_version: 3.3.19
218
230
  signing_key:
219
231
  specification_version: 4
220
232
  summary: Ruby interface to the competitive What? Where? When? rating API
221
- test_files:
222
- - spec/lib/chgk_rating/client_spec.rb
223
- - spec/lib/chgk_rating/collections/player_ratings_spec.rb
224
- - spec/lib/chgk_rating/collections/players_spec.rb
225
- - spec/lib/chgk_rating/collections/recaps_spec.rb
226
- - spec/lib/chgk_rating/collections/team_ratings_spec.rb
227
- - spec/lib/chgk_rating/collections/teams_spec.rb
228
- - spec/lib/chgk_rating/collections/tournaments/player_tournaments_spec.rb
229
- - spec/lib/chgk_rating/collections/tournaments/tournament_team_players_spec.rb
230
- - spec/lib/chgk_rating/collections/tournaments/tournament_team_results_spec.rb
231
- - spec/lib/chgk_rating/collections/tournaments/tournament_teams_spec.rb
232
- - spec/lib/chgk_rating/collections/tournaments/tournaments_spec.rb
233
- - spec/lib/chgk_rating/models/base_spec.rb
234
- - spec/lib/chgk_rating/models/player_rating_spec.rb
235
- - spec/lib/chgk_rating/models/player_spec.rb
236
- - spec/lib/chgk_rating/models/recap_spec.rb
237
- - spec/lib/chgk_rating/models/team_rating_spec.rb
238
- - spec/lib/chgk_rating/models/team_spec.rb
239
- - spec/lib/chgk_rating/models/tournament/tournament_spec.rb
240
- - spec/lib/chgk_rating/models/tournament/tournament_team_player_spec.rb
241
- - spec/lib/chgk_rating/models/tournament/tournament_team_result_spec.rb
242
- - spec/lib/chgk_rating/models/tournament/tournament_team_spec.rb
243
- - spec/lib/chgk_rating/utils/snakecase_spec.rb
244
- - spec/lib/chgk_rating/utils/transformations_spec.rb
245
- - spec/lib/chgk_rating_spec.rb
246
- - spec/lib/ext/date_spec.rb
247
- - spec/lib/ext/date_time_spec.rb
248
- - spec/lib/ext/uri_spec.rb
249
- - spec/spec_helper.rb
250
- - spec/support/shared_examples.rb
251
- - spec/support/test_client.rb
252
- - spec/support/vcr.rb
233
+ test_files: []
@@ -1,247 +0,0 @@
1
- RSpec.shared_examples 'lazy loaded' do
2
- it 'is lazy loaded' do
3
- expect(object.lazy).to eq(true)
4
- end
5
- end
6
-
7
- RSpec.describe ChgkRating::Client do
8
- let(:team_1) { test_client.team(1, true) }
9
- let(:team_52853) { test_client.team(52853, true) }
10
- let(:tournament_3506) { test_client.tournament(3506, true) }
11
-
12
- def with_erroneous_cassette
13
- VCR.use_cassette('erroneous_request') { yield }
14
- end
15
-
16
- context 'errors' do
17
- it 'should raise an error for an erroneous request' do
18
- expect do
19
- # That's a very strange bug that makes VCR raise UnhandledHTTPError
20
- # so for now disable VCR for Ruby 2.5+
21
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.5.0')
22
- test_client.tournament '/thats/an/error'
23
- else
24
- with_erroneous_cassette { test_client.tournament '/thats/an/error' }
25
- end
26
- end.to raise_error(ChgkRating::Error::NotFound)
27
- end
28
- end
29
-
30
- describe '#team_at_tournament' do
31
- subject { test_client.team_at_tournament tournament_3506, team_52853 }
32
-
33
- it { is_expected.to be_an_instance_of ChgkRating::Models::TournamentTeam }
34
-
35
- include_examples 'lazy loaded' do
36
- let(:object) { subject }
37
- end
38
- end
39
-
40
- describe '#tournament' do
41
- subject { test_client.tournament 3506, true }
42
-
43
- include_examples 'lazy loaded' do
44
- let(:object) { subject }
45
- end
46
-
47
- it { is_expected.to be_an_instance_of ChgkRating::Models::Tournament }
48
- end
49
-
50
- describe '#team_rating' do
51
- subject do
52
- VCR.use_cassette('rating_release') { test_client.team_rating team_1, 24 }
53
- end
54
-
55
- it { is_expected.to be_an_instance_of ChgkRating::Models::TeamRating }
56
- end
57
-
58
- describe '#player_rating' do
59
- subject do
60
- VCR.use_cassette('player_rating_release') { test_client.player_rating 42511, 1000 }
61
- end
62
-
63
- it { is_expected.to be_an_instance_of ChgkRating::Models::PlayerRating }
64
- end
65
-
66
- describe '#recap' do
67
- subject do
68
- VCR.use_cassette 'recap_last_season' do
69
- test_client.recap test_client.team(7931, true), :last
70
- end
71
- end
72
-
73
- it { is_expected.to be_an_instance_of ChgkRating::Models::Recap }
74
- end
75
-
76
- describe '#team' do
77
- subject { test_client.team 1, true }
78
-
79
- it { is_expected.to be_an_instance_of ChgkRating::Models::Team }
80
-
81
- include_examples 'lazy loaded' do
82
- let(:object) { subject }
83
- end
84
- end
85
-
86
- describe '#player' do
87
- subject { test_client.player 42511, true }
88
-
89
- it { is_expected.to be_an_instance_of ChgkRating::Models::Player }
90
-
91
- include_examples 'lazy loaded' do
92
- let(:object) { subject }
93
- end
94
- end
95
-
96
- describe '#team_ratings' do
97
- subject do
98
- VCR.use_cassette 'team_ratings' do
99
- test_client.team_ratings team_1
100
- end
101
- end
102
- it { is_expected.to be_an_instance_of ChgkRating::Collections::TeamRatings }
103
- end
104
-
105
- describe '#player_ratings' do
106
- subject do
107
- VCR.use_cassette 'player_ratings_all_releases' do
108
- test_client.player_ratings 42511
109
- end
110
- end
111
- it { is_expected.to be_an_instance_of ChgkRating::Collections::PlayerRatings }
112
- end
113
-
114
- describe '#team_players_at_tournament' do
115
- subject do
116
- VCR.use_cassette 'team_players_at_tournament' do
117
- test_client.team_players_at_tournament tournament_3506, team_52853
118
- end
119
- end
120
-
121
- it { is_expected.to be_an_instance_of ChgkRating::Collections::TournamentTeamPlayers }
122
- end
123
-
124
- describe '#team_results_at_tournament' do
125
- subject do
126
- VCR.use_cassette 'team_results_at_tournament' do
127
- test_client.team_results_at_tournament tournament_3506, team_52853
128
- end
129
- end
130
-
131
- it { is_expected.to be_an_instance_of ChgkRating::Collections::TournamentTeamResults }
132
- end
133
-
134
- describe '#teams_at_tournament' do
135
- subject do
136
- VCR.use_cassette 'teams_at_tournament' do
137
- test_client.teams_at_tournament tournament_3506
138
- end
139
- end
140
-
141
- it { is_expected.to be_an_instance_of ChgkRating::Collections::TournamentTeams }
142
- end
143
-
144
- describe '#player_tournaments' do
145
- context 'all tournaments for a player by season' do
146
- subject do
147
- VCR.use_cassette 'player_tournaments_season' do
148
- test_client.player_tournaments 1000, 51
149
- end
150
- end
151
-
152
- it { is_expected.to be_an_instance_of ChgkRating::Collections::PlayerTournaments }
153
- end
154
-
155
- context 'tournaments for a player' do
156
- subject do
157
- VCR.use_cassette 'player_tournaments' do
158
- test_client.player_tournaments 1000
159
- end
160
- end
161
-
162
- it { is_expected.to be_an_instance_of ChgkRating::Collections::PlayerTournaments }
163
- end
164
- end
165
-
166
- describe '#tournaments' do
167
- context 'all tournaments for a team by season' do
168
- subject do
169
- VCR.use_cassette 'team_tournaments_season' do
170
- test_client.tournaments team_or_id: team_1, season_id: 4
171
- end
172
- end
173
-
174
- it { is_expected.to be_an_instance_of ChgkRating::Collections::Tournaments }
175
- end
176
-
177
- context 'tournaments for a team' do
178
- subject do
179
- VCR.use_cassette 'team_tournaments' do
180
- test_client.tournaments team_or_id: team_1
181
- end
182
- end
183
-
184
- it { is_expected.to be_an_instance_of ChgkRating::Collections::Tournaments }
185
- end
186
-
187
- context 'all tournaments' do
188
- subject do
189
- VCR.use_cassette 'tournaments' do
190
- test_client.tournaments
191
- end
192
- end
193
-
194
- it { is_expected.to be_an_instance_of ChgkRating::Collections::Tournaments }
195
- end
196
- end
197
-
198
- describe '#recaps' do
199
- subject do
200
- VCR.use_cassette 'recaps' do
201
- test_client.recaps team_1
202
- end
203
- end
204
-
205
- it { is_expected.to be_an_instance_of ChgkRating::Collections::Recaps }
206
- end
207
-
208
- describe '#search_teams' do
209
- subject do
210
- VCR.use_cassette 'teams_searching' do
211
- test_client.search_teams name: 'э', town: 'мин'
212
- end
213
- end
214
-
215
- it { is_expected.to be_an_instance_of ChgkRating::Collections::Teams::Search }
216
- end
217
-
218
- describe '#teams' do
219
- subject do
220
- VCR.use_cassette 'teams' do
221
- test_client.teams
222
- end
223
- end
224
-
225
- it { is_expected.to be_an_instance_of ChgkRating::Collections::Teams }
226
- end
227
-
228
- describe '#search_players' do
229
- subject do
230
- VCR.use_cassette 'players_searching' do
231
- test_client.search_players name: 'вас', surname: 'а'
232
- end
233
- end
234
-
235
- it { is_expected.to be_an_instance_of ChgkRating::Collections::Players::Search }
236
- end
237
-
238
- describe '#players' do
239
- subject do
240
- VCR.use_cassette 'players' do
241
- test_client.players
242
- end
243
- end
244
-
245
- it { is_expected.to be_an_instance_of ChgkRating::Collections::Players }
246
- end
247
- end
@@ -1,15 +0,0 @@
1
- RSpec.describe ChgkRating::Collections::PlayerRatings do
2
- subject do
3
- VCR.use_cassette 'player_ratings' do
4
- described_class.new(player: 1000)[-1]
5
- end
6
- end
7
-
8
- specify('#player') { expect(subject.player.id).to eq '1000' }
9
- specify('#release_id') { expect(subject.release_id).to eq '1336' }
10
- specify('#rating') { expect(subject.rating).to eq 7674 }
11
- specify('#rating_position') { expect(subject.rating_position).to eq 1417 }
12
- specify('#date') { expect(subject.date).to eq Date.new(2018, 04, 12) }
13
- specify('#tournaments_in_year') { expect(subject.tournaments_in_year).to eq 15 }
14
- specify('#tournament_count_total') { expect(subject.tournament_count_total).to eq 284 }
15
- end
@@ -1,45 +0,0 @@
1
- RSpec.describe ChgkRating::Collections::Players do
2
- let(:player) { subject[1] }
3
- subject do
4
- VCR.use_cassette 'players' do
5
- described_class.new
6
- end
7
- end
8
-
9
- it_behaves_like 'not a hash'
10
- it_behaves_like 'an array'
11
-
12
- specify '#to_a' do
13
- players_arr = subject.to_a
14
- expect(players_arr.count).to eq 1000
15
- expect(players_arr[10]['surname']).to eq 'Абарников'
16
- end
17
- specify('#id') { expect(player.id).to eq '6' }
18
- specify('#surname') { expect(player.surname).to eq 'Абаков' }
19
- specify('#name') { expect(player.name).to eq 'Карен' }
20
- it 'respond_to should still work properly' do
21
- expect(subject.respond_to?(:count)).to eq true
22
- end
23
-
24
- context 'searching' do
25
- subject do
26
- VCR.use_cassette 'players_searching' do
27
- test_client.search_players(name: 'вас', surname: 'а')[28]
28
- end
29
- end
30
-
31
- specify('#id') { expect(subject.id).to eq '148380' }
32
- specify('#surname') { expect(subject.surname).to eq 'Абросимов' }
33
- end
34
-
35
- context 'pagination' do
36
- subject do
37
- VCR.use_cassette 'players_page3' do
38
- described_class.new(page: 3)[1]
39
- end
40
- end
41
-
42
- specify('#id') { expect(subject.id).to eq '2101' }
43
- specify('#surname') { expect(subject.surname).to eq 'Бажов' }
44
- end
45
- end
@@ -1,21 +0,0 @@
1
- RSpec.describe ChgkRating::Collections::Recaps do
2
- subject do
3
- VCR.use_cassette 'recaps' do
4
- described_class.new(team: 1)
5
- end
6
- end
7
- let(:recaps) { subject['6'] }
8
-
9
- it_behaves_like 'a hash'
10
- it_behaves_like 'not an array'
11
-
12
- specify '#to_h' do
13
- recaps_h = subject.to_h
14
- expect(recaps_h['6']['idseason']).to eq '6'
15
- expect(recaps_h['6']['captain']).to eq '2935'
16
- end
17
- specify('#season_id') { expect(recaps.season_id).to eq '6' }
18
- specify('#team') { expect(recaps.team.id).to eq '1' }
19
- specify('#captain') { expect(recaps.captain.id).to eq '2935' }
20
- specify('#players') { expect(recaps.players.first.id).to eq '1585' }
21
- end
@@ -1,25 +0,0 @@
1
- RSpec.describe ChgkRating::Collections::TeamRatings do
2
- subject do
3
- VCR.use_cassette 'team_ratings' do
4
- described_class.new(team: 1)
5
- end
6
- end
7
- let(:ratings) do
8
- subject[0]
9
- end
10
-
11
- it_behaves_like 'not a hash'
12
- it_behaves_like 'an array'
13
-
14
- specify '#to_a' do
15
- ratings_arr = subject.to_a
16
- expect(ratings_arr.count).to eq 572
17
- expect(ratings_arr[500]['date']).to eq '2006-08-17'
18
- end
19
- specify('#date') { expect(ratings.date.to_s).to eq '2003-07-01' }
20
- specify('#formula') { expect(ratings.formula).to eq :a }
21
- specify('#rating_position') { expect(ratings.rating_position).to eq 8 }
22
- specify('#release_id') { expect(ratings.release_id).to eq '1' }
23
- specify('#team') { expect(ratings.team.id).to eq '1' }
24
- specify('#rating') { expect(ratings.rating).to eq 6093 }
25
- end
@@ -1,42 +0,0 @@
1
- RSpec.describe ChgkRating::Collections::Teams do
2
- subject do
3
- VCR.use_cassette 'teams' do
4
- described_class.new
5
- end
6
- end
7
- let(:team) { subject[1] }
8
-
9
- it_behaves_like 'not a hash'
10
- it_behaves_like 'an array'
11
-
12
- specify('#id') { expect(team.id).to eq '2' }
13
- specify('#town') { expect(team.town).to eq 'Москва' }
14
- specify('#name') { expect(team.name).to eq 'Афина' }
15
- specify '#to_a' do
16
- teams_arr = subject.to_a
17
- expect(teams_arr.count).to eq 1000
18
- expect(teams_arr[3]['idteam']).to eq '5'
19
- end
20
-
21
- context 'pagination' do
22
- subject do
23
- VCR.use_cassette 'teams_page3' do
24
- described_class.new(page: 3)[1]
25
- end
26
- end
27
-
28
- specify('#id') { expect(subject.id).to eq '2285' }
29
- specify('#name') { expect(subject.name).to eq 'Эффект внезапности' }
30
- end
31
-
32
- context 'searching' do
33
- subject do
34
- VCR.use_cassette 'teams_searching' do
35
- described_class.search(request: {name: 'э', town: 'мин'})[0]
36
- end
37
- end
38
-
39
- specify('#id') { expect(subject.id).to eq '5444' }
40
- specify('#name') { expect(subject.name).to eq 'Эйфью' }
41
- end
42
- end
@@ -1,38 +0,0 @@
1
- RSpec.describe ChgkRating::Collections::PlayerTournaments do
2
- context 'all tournaments for a player' do
3
- subject do
4
- VCR.use_cassette 'player_tournaments' do
5
- described_class.new(player: 1000)
6
- end
7
- end
8
- let(:player_tournament) { subject['3'][0] }
9
-
10
- specify '#to_h' do
11
- subject_h = subject.to_h['6']
12
- expect(subject_h['tournaments'][0]['idtournament']).to eq '220'
13
- expect(subject_h['tournaments'][0]['in_base_team']).to eq '1'
14
- expect(subject_h['tournaments'][0]['idteam']).to eq '233'
15
- expect(subject_h['idplayer']).to eq '1000'
16
- end
17
- specify('#tournament') { expect(player_tournament.tournament.id).to eq '91' }
18
- end
19
-
20
- context 'all tournaments for a player by season' do
21
- subject do
22
- VCR.use_cassette 'player_tournaments_season' do
23
- described_class.new(player: 1000, season_id: 51)
24
- end
25
- end
26
- let(:player_tournament) { subject[0] }
27
-
28
- specify '#to_a' do
29
- tournaments_arr = subject.to_a
30
- expect(tournaments_arr[2]['idtournament']).to eq '4782'
31
- end
32
- specify('#tournament') { expect(player_tournament.tournament.id).to eq '4712' }
33
- specify('#team') { expect(player_tournament.team.id).to eq '51284' }
34
- specify('#in_base_team') { expect(player_tournament.in_base_team).to eq false }
35
- specify('#player') { expect(subject.player.id).to eq 1000 }
36
- specify('#season_id') { expect(subject.season_id).to eq 51 }
37
- end
38
- end
@@ -1,18 +0,0 @@
1
- RSpec.describe ChgkRating::Collections::TournamentTeamPlayers do
2
- subject do
3
- VCR.use_cassette 'team_players_at_tournament' do
4
- described_class.new(tournament: 3506, team: 52853)
5
- end
6
- end
7
-
8
-
9
- it_behaves_like 'tournament team player' do
10
- let(:player) { subject[0] }
11
- end
12
- it_behaves_like 'not a hash'
13
- it_behaves_like 'an array'
14
-
15
- specify '#to_a' do
16
- expect(subject.to_a[2]['idplayer']).to eq '51250'
17
- end
18
- end