ruby-lichess 0.2.1 → 0.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 +4 -4
- data/Gemfile.lock +7 -7
- data/bin/console +1 -1
- data/lib/lichess/client.rb +2 -2
- data/lib/lichess/users_gateway.rb +9 -4
- data/lib/lichess/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 77bf772731d1cae63c57d0e68591cbc49f5451cf
|
|
4
|
+
data.tar.gz: f73c78707214e0b43d80506b3d637c6fb0e506fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6dd399d9c41d566a4910b56f3bc941f1ed02065266fb510a8bf12a2d4f4b9d627397e9982e9f349c9f5dee64b2605ce806de745f53fd782750b3b1b009ab5dd1
|
|
7
|
+
data.tar.gz: ac217b9dbd147b6345852a6568cdaa1b157c7089f562786b2cf667d8523a4f57027d6df47897dc576d3eb5649da7afb2747dcd8f0ea6170b2861cb73b9ae64a2
|
data/Gemfile.lock
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
ruby-lichess (0.2.
|
|
4
|
+
ruby-lichess (0.2.1)
|
|
5
5
|
http (~> 4.0)
|
|
6
6
|
ndjson (~> 1.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
addressable (2.
|
|
12
|
-
public_suffix (>= 2.0.2, <
|
|
11
|
+
addressable (2.7.0)
|
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
13
13
|
coderay (1.1.2)
|
|
14
14
|
diff-lcs (1.3)
|
|
15
|
-
domain_name (0.5.
|
|
15
|
+
domain_name (0.5.20190701)
|
|
16
16
|
unf (>= 0.0.5, < 1.0.0)
|
|
17
17
|
dotenv (2.5.0)
|
|
18
|
-
http (4.
|
|
18
|
+
http (4.1.1)
|
|
19
19
|
addressable (~> 2.3)
|
|
20
20
|
http-cookie (~> 1.0)
|
|
21
21
|
http-form_data (~> 2.0)
|
|
@@ -29,7 +29,7 @@ GEM
|
|
|
29
29
|
pry (0.11.3)
|
|
30
30
|
coderay (~> 1.1.0)
|
|
31
31
|
method_source (~> 0.9.0)
|
|
32
|
-
public_suffix (
|
|
32
|
+
public_suffix (4.0.1)
|
|
33
33
|
rake (10.5.0)
|
|
34
34
|
rspec (3.8.0)
|
|
35
35
|
rspec-core (~> 3.8.0)
|
|
@@ -46,7 +46,7 @@ GEM
|
|
|
46
46
|
rspec-support (3.8.0)
|
|
47
47
|
unf (0.1.4)
|
|
48
48
|
unf_ext
|
|
49
|
-
unf_ext (0.0.7.
|
|
49
|
+
unf_ext (0.0.7.6)
|
|
50
50
|
|
|
51
51
|
PLATFORMS
|
|
52
52
|
ruby
|
data/bin/console
CHANGED
data/lib/lichess/client.rb
CHANGED
|
@@ -42,9 +42,9 @@ module Lichess
|
|
|
42
42
|
http_headers[:accept] ||= "application/vnd.lichess.v3+json"
|
|
43
43
|
http_headers[:content_type] ||= "application/json"
|
|
44
44
|
|
|
45
|
-
response =
|
|
45
|
+
response = @http
|
|
46
46
|
.headers(http_headers)
|
|
47
|
-
.post(url)
|
|
47
|
+
.post(url, body: body)
|
|
48
48
|
|
|
49
49
|
return response
|
|
50
50
|
end
|
|
@@ -8,12 +8,17 @@ module Lichess
|
|
|
8
8
|
@client = client
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
-
def get(
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
def get(usernames)
|
|
12
|
+
if usernames.is_a?(Array)
|
|
13
|
+
path = "/api/users"
|
|
14
|
+
result = @client.post(path, body: usernames.join(","))
|
|
15
|
+
else
|
|
16
|
+
path = "/api/user/#{usernames}"
|
|
17
|
+
result = @client.get(path)
|
|
18
|
+
end
|
|
14
19
|
|
|
15
20
|
if result.code == 404
|
|
16
|
-
raise Lichess::Exception::UserNotFound.new("#{
|
|
21
|
+
raise Lichess::Exception::UserNotFound.new("#{usernames} not found")
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
JSON.parse(result.body)
|
data/lib/lichess/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby-lichess
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- omgrr
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-09-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: ndjson
|