rating-chgk-v2 1.5.0 → 1.6.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 +6 -0
- data/README.md +1 -0
- data/lib/rating_chgk_v2/endpoints/base_endpoint.rb +9 -15
- data/lib/rating_chgk_v2/request.rb +7 -0
- data/lib/rating_chgk_v2/rest/countries.rb +1 -1
- data/lib/rating_chgk_v2/rest/players.rb +1 -1
- data/lib/rating_chgk_v2/rest/seasons.rb +1 -1
- data/lib/rating_chgk_v2/rest/teams.rb +1 -1
- data/lib/rating_chgk_v2/rest/venues.rb +1 -1
- data/lib/rating_chgk_v2/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92553b2ca3c5258a683a08817cdc4ef276878afe738560cb2c553d902b8052b3
|
4
|
+
data.tar.gz: 033be3cb040a1833605d621441e07716f223e791a76dca4eeb1d0c3a849d8cc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea47a1823b8e58ec45485a6293092d9c83daa0ba4a5f20bb0965cc9a507f0160ef71ab93c29e95c213ab023a568b1c1d162c1a1444adce390f0ec561ba198a7
|
7
|
+
data.tar.gz: 4d24495f1258df963a0e1cfb6643e9f20635b0ee46d8971e6c5caf228dfd6e7b63d03c29aafeada8824f2731d950ca1db17aae40355b6ab750a23372ce571fe4
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
![CI](https://github.com/bodrovis/rating-chgk-v2/actions/workflows/ci.yml/badge.svg)
|
5
5
|
[![Coverage Status](https://coveralls.io/repos/github/bodrovis/rating-chgk-v2/badge.svg?branch=master)](https://coveralls.io/github/bodrovis/rating-chgk-v2?branch=master)
|
6
6
|
![Downloads total](https://img.shields.io/gem/dt/rating-chgk-v2)
|
7
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/7f66becb60a968a1ca9f/maintainability)](https://codeclimate.com/github/bodrovis/rating-chgk-v2/maintainability)
|
7
8
|
|
8
9
|
Ruby client for [competitive "What? Where? When?" (aka "CHGK") API](http://api.rating.chgk.net/). This gem is a replacement for [ChgkRating](https://github.com/bodrovis/ChgkRating) which worked only with the deprecated API version.
|
9
10
|
|
@@ -7,6 +7,8 @@ module RatingChgkV2
|
|
7
7
|
|
8
8
|
attr_reader :params
|
9
9
|
|
10
|
+
HTTP_METHODS = %i[get post put delete patch].freeze
|
11
|
+
|
10
12
|
def initialize(client, query_params = [], params = {})
|
11
13
|
@instance_query = base_query.push(*query_params)
|
12
14
|
setup client, @instance_query, params
|
@@ -19,24 +21,16 @@ module RatingChgkV2
|
|
19
21
|
self
|
20
22
|
end
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
return true if HTTP_METHODS_REGEXP.match?(method.to_s)
|
28
|
-
|
29
|
-
super
|
30
|
-
end
|
31
|
-
|
32
|
-
def method_missing(method, *_args)
|
33
|
-
if method.to_s =~ HTTP_METHODS_REGEXP
|
34
|
-
send Regexp.last_match(1), @uri, @client, @params
|
35
|
-
else
|
36
|
-
super
|
24
|
+
# Creates methods like `do_post`, `do_get` that proxy calls to the
|
25
|
+
# corresponding methods in the `Request` module
|
26
|
+
HTTP_METHODS.each do |method_postfix|
|
27
|
+
define_method "do_#{method_postfix}" do
|
28
|
+
send method_postfix, @uri, @client, @params
|
37
29
|
end
|
38
30
|
end
|
39
31
|
|
32
|
+
private
|
33
|
+
|
40
34
|
def setup(client, query_params = [], params = {})
|
41
35
|
@query_params = query_params
|
42
36
|
@uri = partial_uri(@query_params)
|
@@ -26,6 +26,13 @@ module RatingChgkV2
|
|
26
26
|
)
|
27
27
|
end
|
28
28
|
|
29
|
+
def patch(path, client, params = {})
|
30
|
+
respond_with(
|
31
|
+
connection(client).patch(prepare(path), custom_dump(params)),
|
32
|
+
client
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
29
36
|
def delete(path, client, _params = {})
|
30
37
|
respond_with(
|
31
38
|
connection(client).delete(prepare(path)),
|
@@ -16,7 +16,7 @@ module RatingChgkV2
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def update_country(id, params)
|
19
|
-
model_load name: 'Country', ep_name: 'Countries', ep_params: [id, params], method: :
|
19
|
+
model_load name: 'Country', ep_name: 'Countries', ep_params: [id, params], method: :do_patch
|
20
20
|
end
|
21
21
|
|
22
22
|
def delete_country(id)
|
@@ -24,7 +24,7 @@ module RatingChgkV2
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def update_player(id, params)
|
27
|
-
model_load name: 'Player', ep_name: 'Players', ep_params: [id, params], method: :
|
27
|
+
model_load name: 'Player', ep_name: 'Players', ep_params: [id, params], method: :do_patch
|
28
28
|
end
|
29
29
|
|
30
30
|
def delete_player(id)
|
@@ -16,7 +16,7 @@ module RatingChgkV2
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def update_season(id, params)
|
19
|
-
model_load name: 'Season', ep_name: 'Seasons', ep_params: [id, params], method: :
|
19
|
+
model_load name: 'Season', ep_name: 'Seasons', ep_params: [id, params], method: :do_patch
|
20
20
|
end
|
21
21
|
|
22
22
|
def delete_season(id)
|
@@ -24,7 +24,7 @@ module RatingChgkV2
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def update_team(id, params)
|
27
|
-
model_load name: 'Team', ep_name: 'Teams', ep_params: [id, params], method: :
|
27
|
+
model_load name: 'Team', ep_name: 'Teams', ep_params: [id, params], method: :do_patch
|
28
28
|
end
|
29
29
|
|
30
30
|
def delete_team(id)
|
@@ -16,7 +16,7 @@ module RatingChgkV2
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def update_venue(id, params)
|
19
|
-
model_load name: 'Venue', ep_name: 'Venues', ep_params: [id, params], method: :
|
19
|
+
model_load name: 'Venue', ep_name: 'Venues', ep_params: [id, params], method: :do_patch
|
20
20
|
end
|
21
21
|
|
22
22
|
def delete_venue(id)
|
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.
|
4
|
+
version: 1.6.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: 2023-
|
11
|
+
date: 2023-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -391,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
391
|
- !ruby/object:Gem::Version
|
392
392
|
version: '0'
|
393
393
|
requirements: []
|
394
|
-
rubygems_version: 3.4.
|
394
|
+
rubygems_version: 3.4.22
|
395
395
|
signing_key:
|
396
396
|
specification_version: 4
|
397
397
|
summary: Ruby interface for the new CHGK rating API
|