rating-chgk-v2 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7dad45c8ac28f2ea451f5fe52b6fc9df788e706a4d8f3abedaa58e16b14ca6c
4
- data.tar.gz: 5834bf7e0ac6dbdcba393203324c0f4142776a919fb57709c57388ddcd0f2724
3
+ metadata.gz: 8e82a452c26437c94944fd10d4072008445a0deba02293cfbf850a4bdb24b1b8
4
+ data.tar.gz: cf32706c94c14ab9437fc0f381e303a367b1911c3c97a90ee4d56e89d304eb47
5
5
  SHA512:
6
- metadata.gz: 87b5add4aea56622ec5544514ee056b7bfaa3d021cbb1f0ad270ec8a77775b78b78991e8f3e70fc9548488cb95fbe55b8fa276b22d0ec84a8baf053d6b1735b1
7
- data.tar.gz: af776aad282c2b747ce02e8ee6064c53837c3e14578e365af8584f9d09b2eb493e274b66a5b06304f24bf5e2a0eee305a11429f7a5bf76e417b55ae977b0f760
6
+ metadata.gz: e81c690c74facc303c2697fb5ef422fb615e2e0cb0c163dcdd21981ed4351ff54ce946d9a9976333e9480557161a677715ccd66f20e5a0a2881b21b2c67df9ba
7
+ data.tar.gz: 165806f74a9d7de97640320c3af6d820edc591f37465e78dbbfb0384d2654524867a7654666fe03c86f974da634987bc614d8ec6cf3a39b5cf88798ec66419c3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.0 (18-Nov-22)
4
+
5
+ * Added `create_result` method for the `Tournament` model and `create_tournament_result`, `update_tournament_result`, `delete_tournament_result` methods.
6
+ * Added `update` and `destroy` methods for the `Player` model as well as `update_player` and `delete_player` methods (thanks, @DasRegal)
7
+ * Added `create_player` method.
8
+ * Added `create_team`, `update_team`, and `delete_team` methods.
9
+ * Added `update` and `destroy` method to the `Team` model.
10
+
11
+ ## 1.2.0 (17-Oct-22)
12
+
13
+ * Properly handle flat params:
14
+
15
+ ```ruby
16
+ client.tournaments 'type[]': [1, 2, 3] # requesting tournaments with IDs 1, 2, or 3
17
+ ```
18
+
3
19
  ## 1.1.0 (29-Jul-22)
4
20
 
5
21
  * Added requests for venues (thanks, @L-Eugene)
data/Rakefile CHANGED
@@ -1,6 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rake'
4
+ require 'rake/clean'
5
+ require 'rspec/core/rake_task'
6
+ require 'rubocop/rake_task'
4
7
 
5
8
  begin
6
9
  require 'bundler/setup'
@@ -9,13 +12,32 @@ rescue LoadError
9
12
  puts 'although not required, bundler is recommened for running the tests'
10
13
  end
11
14
 
12
- task default: :spec
13
-
14
- require 'rspec/core/rake_task'
15
15
  RSpec::Core::RakeTask.new(:spec)
16
16
 
17
- require 'rubocop/rake_task'
18
17
  RuboCop::RakeTask.new do |task|
19
18
  task.requires << 'rubocop-performance'
20
19
  task.requires << 'rubocop-rspec'
21
20
  end
21
+
22
+ CLOBBER.include(FileList['./*.gem'])
23
+
24
+ namespace :chgk do
25
+ desc 'Updates RubyGems, installs dependencies'
26
+ task :install do
27
+ puts 'Running bundle install'
28
+ sh 'gem update --system'
29
+ sh 'bundle'
30
+ end
31
+
32
+ desc 'Builds the gem'
33
+ task :build do
34
+ puts 'Building'
35
+ sh 'gem build rating-chgk-v2.gemspec'
36
+ end
37
+ end
38
+
39
+ task rubospec: %w[rubocop spec]
40
+
41
+ task full_build: %w[clobber chgk:install chgk:build]
42
+
43
+ task default: :full_build
@@ -27,7 +27,11 @@ module RatingChgkV2
27
27
 
28
28
  # Allows to customize request params per-client
29
29
  def request_params_for(client)
30
- {request: {timeout: client.timeout, open_timeout: client.open_timeout}}
30
+ {request: {
31
+ timeout: client.timeout,
32
+ open_timeout: client.open_timeout,
33
+ params_encoder: Faraday::FlatParamsEncoder
34
+ }}
31
35
  end
32
36
  end
33
37
  end
@@ -12,6 +12,15 @@ module RatingChgkV2
12
12
  endpoint.reinitialize new_params: params, add_query: :tournaments
13
13
  RatingChgkV2::Collections::PlayerTournamentsCollection.load :do_get, endpoint
14
14
  end
15
+
16
+ def update(params = {})
17
+ endpoint.reinitialize new_params: params
18
+ self.class.load :do_put, endpoint
19
+ end
20
+
21
+ def destroy
22
+ endpoint.do_delete
23
+ end
15
24
  end
16
25
  end
17
26
  end
@@ -12,6 +12,15 @@ module RatingChgkV2
12
12
  endpoint.reinitialize new_params: params, add_query: :tournaments
13
13
  RatingChgkV2::Collections::TeamTournamentsCollection.load :do_get, endpoint
14
14
  end
15
+
16
+ def update(params = {})
17
+ endpoint.reinitialize new_params: params
18
+ self.class.load :do_put, endpoint
19
+ end
20
+
21
+ def destroy
22
+ endpoint.do_delete
23
+ end
15
24
  end
16
25
  end
17
26
  end
@@ -17,6 +17,11 @@ module RatingChgkV2
17
17
  endpoint.reinitialize new_params: params, add_query: :results
18
18
  RatingChgkV2::Collections::TournamentResultsCollection.load :do_get, endpoint
19
19
  end
20
+
21
+ def create_result(params = {})
22
+ endpoint.reinitialize new_params: params, add_query: :results
23
+ RatingChgkV2::Models::TournamentResultModel.load :do_post, endpoint
24
+ end
20
25
  end
21
26
  end
22
27
  end
@@ -18,6 +18,18 @@ module RatingChgkV2
18
18
  def player_tournaments(id, params = {})
19
19
  collection_load name: 'PlayerTournaments', ep_name: 'Players', ep_params: [[id, :tournaments], params]
20
20
  end
21
+
22
+ def create_player(params)
23
+ model_load name: 'Player', ep_name: 'Players', ep_params: [[], params], method: :do_post
24
+ end
25
+
26
+ def update_player(id, params)
27
+ model_load name: 'Player', ep_name: 'Players', ep_params: [id, params], method: :do_put
28
+ end
29
+
30
+ def delete_player(id)
31
+ endpoint('Players', id).do_delete
32
+ end
21
33
  end
22
34
  end
23
35
  end
@@ -18,6 +18,18 @@ module RatingChgkV2
18
18
  def team_tournaments(id, params = {})
19
19
  collection_load name: 'TeamTournaments', ep_name: 'Teams', ep_params: [[id, :tournaments], params]
20
20
  end
21
+
22
+ def create_team(params)
23
+ model_load name: 'Team', ep_name: 'Teams', ep_params: [[], params], method: :do_post
24
+ end
25
+
26
+ def update_team(id, params)
27
+ model_load name: 'Team', ep_name: 'Teams', ep_params: [id, params], method: :do_put
28
+ end
29
+
30
+ def delete_team(id)
31
+ endpoint('Teams', id).do_delete
32
+ end
21
33
  end
22
34
  end
23
35
  end
@@ -22,6 +22,20 @@ module RatingChgkV2
22
22
  def tournament_results(id, params = {})
23
23
  collection_load name: 'TournamentResults', ep_name: 'Tournaments', ep_params: [[id, :results], params]
24
24
  end
25
+
26
+ def create_tournament_result(id, params)
27
+ model_load name: 'TournamentResult', ep_name: 'Tournaments', ep_params: [[id, :results], params],
28
+ method: :do_post
29
+ end
30
+
31
+ def update_tournament_result(id, params)
32
+ model_load name: 'TournamentResult', ep_name: 'Tournaments', ep_params: [[id, :results], params],
33
+ method: :do_put
34
+ end
35
+
36
+ def delete_tournament_result(id)
37
+ endpoint('Tournaments', [id, :results]).do_delete
38
+ end
25
39
  end
26
40
  end
27
41
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RatingChgkV2
4
- VERSION = '1.1.0'
4
+ VERSION = '1.3.0'
5
5
  end
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rspec', '~> 3.6'
34
34
  spec.add_development_dependency 'rubocop', '~> 1.6'
35
35
  spec.add_development_dependency 'rubocop-performance', '~> 1.5'
36
+ spec.add_development_dependency 'rubocop-rake', '~> 0.6'
36
37
  spec.add_development_dependency 'rubocop-rspec', '~> 2.0'
37
38
  spec.add_development_dependency 'simplecov', '~> 0.16'
38
39
  spec.add_development_dependency 'vcr', '~> 6.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rating-chgk-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya Krukowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-29 00:00:00.000000000 Z
11
+ date: 2022-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: '1.5'
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop-rake
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: '0.6'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: '0.6'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: rubocop-rspec
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -363,7 +377,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
363
377
  - !ruby/object:Gem::Version
364
378
  version: '0'
365
379
  requirements: []
366
- rubygems_version: 3.3.19
380
+ rubygems_version: 3.3.26
367
381
  signing_key:
368
382
  specification_version: 4
369
383
  summary: Ruby interface for the new CHGK rating API