rating-chgk-v2 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7cea429b4143eac837e8925c99b756c5085e5e4d14939dacd137e5d2d2a2801
4
- data.tar.gz: 00a0d90bcdd94b3b725fb77996d2482073a6cb2aea262a23d4dedddc736ce256
3
+ metadata.gz: 8e82a452c26437c94944fd10d4072008445a0deba02293cfbf850a4bdb24b1b8
4
+ data.tar.gz: cf32706c94c14ab9437fc0f381e303a367b1911c3c97a90ee4d56e89d304eb47
5
5
  SHA512:
6
- metadata.gz: 42b41f53941786a3d72002a10395e8400d39fee6c8d5e7bcd69d76e0053886fef18fedad82d64b566619e75bb0aa9aa29075afdadb3dd314fe5d83f05337d44b
7
- data.tar.gz: c2076f389f03ac389d6f025fc12f60121c039e05525d076ab3122a8b34834b018fe014c8c5b23a07a6124fa1e0cf61607b48a0967518c55724d4f8afeab6ab7a
6
+ metadata.gz: e81c690c74facc303c2697fb5ef422fb615e2e0cb0c163dcdd21981ed4351ff54ce946d9a9976333e9480557161a677715ccd66f20e5a0a2881b21b2c67df9ba
7
+ data.tar.gz: 165806f74a9d7de97640320c3af6d820edc591f37465e78dbbfb0384d2654524867a7654666fe03c86f974da634987bc614d8ec6cf3a39b5cf88798ec66419c3
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
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
+
3
11
  ## 1.2.0 (17-Oct-22)
4
12
 
5
13
  * Properly handle flat params:
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
@@ -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.2.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.2.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-10-17 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.24
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