chgk_rating 1.0.0 → 2.0.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 +19 -0
- data/README.md +8 -499
- data/chgk_rating.gemspec +7 -6
- data/lib/chgk_rating/attribute_mappings.rb +20 -4
- data/lib/chgk_rating/chgk_object.rb +1 -0
- data/lib/chgk_rating/client.rb +40 -9
- data/lib/chgk_rating/collections/ratings/player_ratings.rb +22 -0
- data/lib/chgk_rating/collections/{ratings.rb → ratings/team_ratings.rb} +2 -3
- data/lib/chgk_rating/collections/tournaments/player_tournaments.rb +44 -0
- data/lib/chgk_rating/collections/{tournament_players.rb → tournaments/tournament_team_players.rb} +2 -2
- data/lib/chgk_rating/collections/{tournament_team_results.rb → tournaments/tournament_team_results.rb} +0 -0
- data/lib/chgk_rating/collections/{tournament_teams.rb → tournaments/tournament_teams.rb} +0 -0
- data/lib/chgk_rating/collections/{tournaments.rb → tournaments/tournaments.rb} +2 -1
- data/lib/chgk_rating/connection.rb +4 -1
- data/lib/chgk_rating/models/base.rb +17 -5
- data/lib/chgk_rating/models/player.rb +25 -0
- data/lib/chgk_rating/models/rating/player_rating.rb +16 -0
- data/lib/chgk_rating/models/{tournament_player.rb → rating/rating.rb} +1 -1
- data/lib/chgk_rating/models/{rating.rb → rating/team_rating.rb} +1 -4
- data/lib/chgk_rating/models/team.rb +6 -6
- data/lib/chgk_rating/models/tournament/player_tournament.rb +8 -0
- data/lib/chgk_rating/models/{tournament.rb → tournament/tournament.rb} +4 -4
- data/lib/chgk_rating/models/{tournament_team.rb → tournament/tournament_team.rb} +3 -3
- data/lib/chgk_rating/models/tournament/tournament_team_player.rb +8 -0
- data/lib/chgk_rating/models/{tournament_team_result.rb → tournament/tournament_team_result.rb} +0 -0
- data/lib/chgk_rating/utils/transformations.rb +1 -0
- data/lib/chgk_rating/version.rb +1 -1
- data/lib/chgk_rating.rb +15 -10
- data/spec/lib/chgk_rating/client_spec.rb +46 -7
- data/spec/lib/chgk_rating/collections/player_ratings_spec.rb +15 -0
- data/spec/lib/chgk_rating/collections/{ratings_spec.rb → team_ratings_spec.rb} +1 -1
- data/spec/lib/chgk_rating/collections/tournaments/player_tournaments_spec.rb +38 -0
- data/spec/lib/chgk_rating/collections/{tournament_players_spec.rb → tournaments/tournament_team_players_spec.rb} +1 -1
- data/spec/lib/chgk_rating/collections/{tournament_team_results_spec.rb → tournaments/tournament_team_results_spec.rb} +0 -0
- data/spec/lib/chgk_rating/collections/{tournament_teams_spec.rb → tournaments/tournament_teams_spec.rb} +0 -0
- data/spec/lib/chgk_rating/collections/{tournaments_spec.rb → tournaments/tournaments_spec.rb} +0 -0
- data/spec/lib/chgk_rating/models/player_rating_spec.rb +22 -0
- data/spec/lib/chgk_rating/models/player_spec.rb +27 -0
- data/spec/lib/chgk_rating/models/{rating_spec.rb → team_rating_spec.rb} +1 -1
- data/spec/lib/chgk_rating/models/team_spec.rb +2 -2
- data/spec/lib/chgk_rating/models/{tournament_spec.rb → tournament/tournament_spec.rb} +3 -3
- data/spec/lib/chgk_rating/models/{tournament_player_spec.rb → tournament/tournament_team_player_spec.rb} +1 -1
- data/spec/lib/chgk_rating/models/{tournament_team_result_spec.rb → tournament/tournament_team_result_spec.rb} +0 -0
- data/spec/lib/chgk_rating/models/{tournament_team_spec.rb → tournament/tournament_team_spec.rb} +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +70 -46
@@ -0,0 +1,22 @@
|
|
1
|
+
RSpec.describe ChgkRating::Models::PlayerRating do
|
2
|
+
subject do
|
3
|
+
VCR.use_cassette 'rating_player_release' do
|
4
|
+
described_class.new 1336, player: 1000
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:rating_h) { subject.to_h }
|
9
|
+
|
10
|
+
specify('#player') { expect(subject.player.id).to eq '1000' }
|
11
|
+
specify('#release_id') { expect(subject.release_id).to eq '1336' }
|
12
|
+
specify('#rating') { expect(subject.rating).to eq 7674 }
|
13
|
+
specify('#rating_position') { expect(subject.rating_position).to eq 1417 }
|
14
|
+
specify('#date') { expect(subject.date).to eq Date.new(2018, 04, 12) }
|
15
|
+
specify('#tournaments_in_year') { expect(subject.tournaments_in_year).to eq 15 }
|
16
|
+
specify('#tournament_count_total') { expect(subject.tournament_count_total).to eq 284 }
|
17
|
+
specify '#to_h' do
|
18
|
+
expect(rating_h['idplayer']).to eq '1000'
|
19
|
+
expect(rating_h['tournaments_in_year']).to eq '15'
|
20
|
+
expect(rating_h['tournament_count_total']).to eq '284'
|
21
|
+
end
|
22
|
+
end
|
@@ -32,4 +32,31 @@ RSpec.describe ChgkRating::Models::Player do
|
|
32
32
|
end
|
33
33
|
expect(lazy_player.name).to eq 'Николай'
|
34
34
|
end
|
35
|
+
|
36
|
+
describe '#rating' do
|
37
|
+
let(:player_rating) do
|
38
|
+
VCR.use_cassette 'player_rating_release' do
|
39
|
+
subject.rating 1000
|
40
|
+
end
|
41
|
+
end
|
42
|
+
it { expect(player_rating).to be_an_instance_of ChgkRating::Models::PlayerRating }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#ratings' do
|
46
|
+
let(:player_ratings) do
|
47
|
+
VCR.use_cassette 'player_ratings_all_releases' do
|
48
|
+
subject.ratings
|
49
|
+
end
|
50
|
+
end
|
51
|
+
it { expect(player_ratings).to be_an_instance_of ChgkRating::Collections::PlayerRatings }
|
52
|
+
end
|
53
|
+
|
54
|
+
describe '#tournaments' do
|
55
|
+
let(:player_tournaments) do
|
56
|
+
VCR.use_cassette 'player_tournaments2' do
|
57
|
+
subject.tournaments
|
58
|
+
end
|
59
|
+
end
|
60
|
+
it { expect(player_tournaments).to be_an_instance_of ChgkRating::Collections::PlayerTournaments }
|
61
|
+
end
|
35
62
|
end
|
@@ -48,7 +48,7 @@ RSpec.describe ChgkRating::Models::Team do
|
|
48
48
|
subject.rating 24
|
49
49
|
end
|
50
50
|
end
|
51
|
-
it { expect(team_rating).to be_an_instance_of ChgkRating::Models::
|
51
|
+
it { expect(team_rating).to be_an_instance_of ChgkRating::Models::TeamRating }
|
52
52
|
end
|
53
53
|
|
54
54
|
describe '#recap' do
|
@@ -84,6 +84,6 @@ RSpec.describe ChgkRating::Models::Team do
|
|
84
84
|
subject.ratings
|
85
85
|
end
|
86
86
|
end
|
87
|
-
it { expect(team_ratings).to be_an_instance_of ChgkRating::Collections::
|
87
|
+
it { expect(team_ratings).to be_an_instance_of ChgkRating::Collections::TeamRatings }
|
88
88
|
end
|
89
89
|
end
|
@@ -71,11 +71,11 @@ RSpec.describe ChgkRating::Models::Tournament do
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
it { expect(players).to be_an_instance_of ChgkRating::Collections::
|
74
|
+
it { expect(players).to be_an_instance_of ChgkRating::Collections::TournamentTeamPlayers }
|
75
75
|
end
|
76
76
|
|
77
|
-
describe '#
|
78
|
-
let(:team) { subject.
|
77
|
+
describe '#team_by' do
|
78
|
+
let(:team) { subject.team_by 52853 }
|
79
79
|
|
80
80
|
it { expect(team).to be_an_instance_of ChgkRating::Models::TournamentTeam }
|
81
81
|
end
|
File without changes
|
data/spec/lib/chgk_rating/models/{tournament_team_spec.rb → tournament/tournament_team_spec.rb}
RENAMED
@@ -21,7 +21,7 @@ RSpec.describe ChgkRating::Models::TournamentTeam do
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
it { expect(players).to be_an_instance_of ChgkRating::Collections::
|
24
|
+
it { expect(players).to be_an_instance_of ChgkRating::Collections::TournamentTeamPlayers }
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '#results' do
|
data/spec/spec_helper.rb
CHANGED
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Bodrov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,42 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.8'
|
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: '
|
26
|
+
version: '1.8'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.2'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: multi_json
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
47
|
+
version: '1.15'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
54
|
+
version: '1.15'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '13.0'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '13.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +86,14 @@ dependencies:
|
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
89
|
+
version: '6.0'
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
96
|
+
version: '6.0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: codeclimate-test-reporter
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -119,25 +133,30 @@ files:
|
|
119
133
|
- lib/chgk_rating/client.rb
|
120
134
|
- lib/chgk_rating/collections/base.rb
|
121
135
|
- lib/chgk_rating/collections/players.rb
|
122
|
-
- lib/chgk_rating/collections/ratings.rb
|
136
|
+
- lib/chgk_rating/collections/ratings/player_ratings.rb
|
137
|
+
- lib/chgk_rating/collections/ratings/team_ratings.rb
|
123
138
|
- lib/chgk_rating/collections/recaps.rb
|
124
139
|
- lib/chgk_rating/collections/teams.rb
|
125
|
-
- lib/chgk_rating/collections/
|
126
|
-
- lib/chgk_rating/collections/
|
127
|
-
- lib/chgk_rating/collections/
|
128
|
-
- lib/chgk_rating/collections/tournaments.rb
|
140
|
+
- lib/chgk_rating/collections/tournaments/player_tournaments.rb
|
141
|
+
- lib/chgk_rating/collections/tournaments/tournament_team_players.rb
|
142
|
+
- lib/chgk_rating/collections/tournaments/tournament_team_results.rb
|
143
|
+
- lib/chgk_rating/collections/tournaments/tournament_teams.rb
|
144
|
+
- lib/chgk_rating/collections/tournaments/tournaments.rb
|
129
145
|
- lib/chgk_rating/concerns/searching.rb
|
130
146
|
- lib/chgk_rating/connection.rb
|
131
147
|
- lib/chgk_rating/error.rb
|
132
148
|
- lib/chgk_rating/models/base.rb
|
133
149
|
- lib/chgk_rating/models/player.rb
|
134
|
-
- lib/chgk_rating/models/rating.rb
|
150
|
+
- lib/chgk_rating/models/rating/player_rating.rb
|
151
|
+
- lib/chgk_rating/models/rating/rating.rb
|
152
|
+
- lib/chgk_rating/models/rating/team_rating.rb
|
135
153
|
- lib/chgk_rating/models/recap.rb
|
136
154
|
- lib/chgk_rating/models/team.rb
|
137
|
-
- lib/chgk_rating/models/tournament.rb
|
138
|
-
- lib/chgk_rating/models/
|
139
|
-
- lib/chgk_rating/models/tournament_team.rb
|
140
|
-
- lib/chgk_rating/models/
|
155
|
+
- lib/chgk_rating/models/tournament/player_tournament.rb
|
156
|
+
- lib/chgk_rating/models/tournament/tournament.rb
|
157
|
+
- lib/chgk_rating/models/tournament/tournament_team.rb
|
158
|
+
- lib/chgk_rating/models/tournament/tournament_team_player.rb
|
159
|
+
- lib/chgk_rating/models/tournament/tournament_team_result.rb
|
141
160
|
- lib/chgk_rating/request.rb
|
142
161
|
- lib/chgk_rating/utils/snakecase.rb
|
143
162
|
- lib/chgk_rating/utils/transformations.rb
|
@@ -146,23 +165,26 @@ files:
|
|
146
165
|
- lib/ext/date_time.rb
|
147
166
|
- lib/ext/uri.rb
|
148
167
|
- spec/lib/chgk_rating/client_spec.rb
|
168
|
+
- spec/lib/chgk_rating/collections/player_ratings_spec.rb
|
149
169
|
- spec/lib/chgk_rating/collections/players_spec.rb
|
150
|
-
- spec/lib/chgk_rating/collections/ratings_spec.rb
|
151
170
|
- spec/lib/chgk_rating/collections/recaps_spec.rb
|
171
|
+
- spec/lib/chgk_rating/collections/team_ratings_spec.rb
|
152
172
|
- spec/lib/chgk_rating/collections/teams_spec.rb
|
153
|
-
- spec/lib/chgk_rating/collections/
|
154
|
-
- spec/lib/chgk_rating/collections/
|
155
|
-
- spec/lib/chgk_rating/collections/
|
156
|
-
- spec/lib/chgk_rating/collections/
|
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
|
157
178
|
- spec/lib/chgk_rating/models/base_spec.rb
|
179
|
+
- spec/lib/chgk_rating/models/player_rating_spec.rb
|
158
180
|
- spec/lib/chgk_rating/models/player_spec.rb
|
159
|
-
- spec/lib/chgk_rating/models/rating_spec.rb
|
160
181
|
- spec/lib/chgk_rating/models/recap_spec.rb
|
182
|
+
- spec/lib/chgk_rating/models/team_rating_spec.rb
|
161
183
|
- spec/lib/chgk_rating/models/team_spec.rb
|
162
|
-
- spec/lib/chgk_rating/models/
|
163
|
-
- spec/lib/chgk_rating/models/
|
164
|
-
- spec/lib/chgk_rating/models/tournament_team_result_spec.rb
|
165
|
-
- spec/lib/chgk_rating/models/tournament_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
|
166
188
|
- spec/lib/chgk_rating/utils/snakecase_spec.rb
|
167
189
|
- spec/lib/chgk_rating/utils/transformations_spec.rb
|
168
190
|
- spec/lib/chgk_rating_spec.rb
|
@@ -173,11 +195,11 @@ files:
|
|
173
195
|
- spec/support/shared_examples.rb
|
174
196
|
- spec/support/test_client.rb
|
175
197
|
- spec/support/vcr.rb
|
176
|
-
homepage:
|
198
|
+
homepage: http://chgk-rating.bodrovis.tech/
|
177
199
|
licenses:
|
178
200
|
- MIT
|
179
201
|
metadata: {}
|
180
|
-
post_install_message:
|
202
|
+
post_install_message:
|
181
203
|
rdoc_options: []
|
182
204
|
require_paths:
|
183
205
|
- lib
|
@@ -192,30 +214,32 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
214
|
- !ruby/object:Gem::Version
|
193
215
|
version: '0'
|
194
216
|
requirements: []
|
195
|
-
|
196
|
-
|
197
|
-
signing_key:
|
217
|
+
rubygems_version: 3.2.33
|
218
|
+
signing_key:
|
198
219
|
specification_version: 4
|
199
220
|
summary: Ruby interface to the competitive What? Where? When? rating API
|
200
221
|
test_files:
|
201
222
|
- spec/lib/chgk_rating/client_spec.rb
|
223
|
+
- spec/lib/chgk_rating/collections/player_ratings_spec.rb
|
202
224
|
- spec/lib/chgk_rating/collections/players_spec.rb
|
203
|
-
- spec/lib/chgk_rating/collections/ratings_spec.rb
|
204
225
|
- spec/lib/chgk_rating/collections/recaps_spec.rb
|
226
|
+
- spec/lib/chgk_rating/collections/team_ratings_spec.rb
|
205
227
|
- spec/lib/chgk_rating/collections/teams_spec.rb
|
206
|
-
- spec/lib/chgk_rating/collections/
|
207
|
-
- spec/lib/chgk_rating/collections/
|
208
|
-
- spec/lib/chgk_rating/collections/
|
209
|
-
- spec/lib/chgk_rating/collections/
|
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
|
210
233
|
- spec/lib/chgk_rating/models/base_spec.rb
|
234
|
+
- spec/lib/chgk_rating/models/player_rating_spec.rb
|
211
235
|
- spec/lib/chgk_rating/models/player_spec.rb
|
212
|
-
- spec/lib/chgk_rating/models/rating_spec.rb
|
213
236
|
- spec/lib/chgk_rating/models/recap_spec.rb
|
237
|
+
- spec/lib/chgk_rating/models/team_rating_spec.rb
|
214
238
|
- spec/lib/chgk_rating/models/team_spec.rb
|
215
|
-
- spec/lib/chgk_rating/models/
|
216
|
-
- spec/lib/chgk_rating/models/
|
217
|
-
- spec/lib/chgk_rating/models/tournament_team_result_spec.rb
|
218
|
-
- spec/lib/chgk_rating/models/tournament_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
|
219
243
|
- spec/lib/chgk_rating/utils/snakecase_spec.rb
|
220
244
|
- spec/lib/chgk_rating/utils/transformations_spec.rb
|
221
245
|
- spec/lib/chgk_rating_spec.rb
|