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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aa1ec7bdcdb6e17e3df5a4316bbe7b09fe01c371
4
- data.tar.gz: 77238e78c75b20149507814046998ce35180a402
3
+ metadata.gz: 77bf772731d1cae63c57d0e68591cbc49f5451cf
4
+ data.tar.gz: f73c78707214e0b43d80506b3d637c6fb0e506fb
5
5
  SHA512:
6
- metadata.gz: 61fd7da46a12b46c011104eb8e074f3ca3cb3326e4d20908d6681360b7181ac39c3bda1e0d56c4ef73ec22e91c253aff29a191227fdef2e5006ffacc161e4476
7
- data.tar.gz: 9c83a66f9e5f6b61ad14cddaca11c63cbc8df371965d7e54c9cbb8827ce5de156111767162d7550860e8fb30b62c979767f3a1b968d34312cc6bc06afbd5bd6f
6
+ metadata.gz: 6dd399d9c41d566a4910b56f3bc941f1ed02065266fb510a8bf12a2d4f4b9d627397e9982e9f349c9f5dee64b2605ce806de745f53fd782750b3b1b009ab5dd1
7
+ data.tar.gz: ac217b9dbd147b6345852a6568cdaa1b157c7089f562786b2cf667d8523a4f57027d6df47897dc576d3eb5649da7afb2747dcd8f0ea6170b2861cb73b9ae64a2
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-lichess (0.2.0)
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.5.2)
12
- public_suffix (>= 2.0.2, < 4.0)
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.20180417)
15
+ domain_name (0.5.20190701)
16
16
  unf (>= 0.0.5, < 1.0.0)
17
17
  dotenv (2.5.0)
18
- http (4.0.0)
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 (3.0.3)
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.5)
49
+ unf_ext (0.0.7.6)
50
50
 
51
51
  PLATFORMS
52
52
  ruby
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "ruby/lichess"
4
+ require "lichess"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -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 = HTTP
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(username)
12
- path = "/api/user/#{username}"
13
- result = @client.get(path)
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("#{username} not found")
21
+ raise Lichess::Exception::UserNotFound.new("#{usernames} not found")
17
22
  end
18
23
 
19
24
  JSON.parse(result.body)
@@ -1,3 +1,3 @@
1
1
  module Lichess
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
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.2.1
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-08-02 00:00:00.000000000 Z
11
+ date: 2019-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ndjson