dblista 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/dblista.rb +7 -6
- data/lib/dblista/errors.rb +2 -0
- data/lib/dblista/user/client.rb +9 -0
- data/lib/dblista/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ba88619d64539697aa11e51f60ecbf292729ae2d6d8c2ae3291caea28b40dc2
|
4
|
+
data.tar.gz: dcdcd9f0bb7482b30d0d388ea6cda59fad862267341e6b28e8e10bd558a0e3c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65e48135e27d24539322178ed7f7f27c437e7a54a2f22cf004780f9babad45b2baa96972f75f4c88e433e05f20be390453a1a6fdeb7b752da42d9e2b4929cb16
|
7
|
+
data.tar.gz: a3d951c2872d596ce2867b905df9d2e513d1c776ca89011c6b1b624a006dd590b66d370e413bc7213828fa317a0291d872f0a6767dec23a2621f61087c0fb12e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
# DBLista
|
1
|
+
# DBLista Ruby wrapper [![Gem Version](https://badge.fury.io/rb/dblista.svg)](https://badge.fury.io/rb/dblista)
|
2
2
|
|
3
3
|
[Dokumentacja](https://www.rubydoc.info/github/marek12306/dblista-wrapper-ruby)
|
4
4
|
|
5
|
-
Gem pozwalający na komunikację z API DBListy. Pozwala m.in. na automatyczne wysyłanie statystyk (dla botów napisanych w Discordrb)
|
5
|
+
Gem pozwalający na komunikację z API DBListy. Pozwala m.in. na automatyczne wysyłanie statystyk (dla botów napisanych w Discordrb), CRUD botów i serwerów oraz pare innych rzeczy.
|
6
6
|
|
7
7
|
## Instalacja
|
8
8
|
|
@@ -36,6 +36,6 @@ top = DBLista::List::Bot.top
|
|
36
36
|
puts top['data'].inspect
|
37
37
|
```
|
38
38
|
|
39
|
-
##
|
39
|
+
## Licencja
|
40
40
|
|
41
41
|
Ten gem jest dostępny na licencji [MIT License](https://opensource.org/licenses/MIT). Rób z nim co chcesz.
|
data/lib/dblista.rb
CHANGED
@@ -22,12 +22,6 @@ module DBLista
|
|
22
22
|
# Regexp for checking if string is a number
|
23
23
|
IS_NUMBER = /^\d+$/.freeze
|
24
24
|
|
25
|
-
# @!visibility private
|
26
|
-
def self._get(path)
|
27
|
-
req = URI.open("#{DBLista::API_PATH}#{path}")
|
28
|
-
JSON.parse req.read
|
29
|
-
end
|
30
|
-
|
31
25
|
def self._https(uri)
|
32
26
|
Net::HTTP.new(uri.host, uri.port).tap do |http|
|
33
27
|
http.use_ssl = true
|
@@ -43,6 +37,13 @@ module DBLista
|
|
43
37
|
JSON.parse response.body
|
44
38
|
end
|
45
39
|
|
40
|
+
# @!visibility private
|
41
|
+
def self._get(path, token = nil)
|
42
|
+
uri = URI("#{DBLista::API_PATH}#{path}")
|
43
|
+
req = Net::HTTP::Get.new(uri)
|
44
|
+
_handle_request(req, uri, token, nil)
|
45
|
+
end
|
46
|
+
|
46
47
|
# @!visibility private
|
47
48
|
def self._post(path, data = nil, token = nil)
|
48
49
|
uri = URI("#{DBLista::API_PATH}#{path}")
|
data/lib/dblista/errors.rb
CHANGED
data/lib/dblista/user/client.rb
CHANGED
@@ -31,6 +31,15 @@ module DBLista::User
|
|
31
31
|
raise DBLista::Error, DBLista::Errors::TOKEN_NOT_PROVIDED unless token
|
32
32
|
|
33
33
|
@token = token
|
34
|
+
|
35
|
+
raise DBLista::Error, DBLista::Errors::INVALID_TOKEN unless me['status'] == 'success'
|
36
|
+
end
|
37
|
+
|
38
|
+
# Fetches information about user
|
39
|
+
#
|
40
|
+
# @return [Hash] raw data from DBLista
|
41
|
+
def me
|
42
|
+
DBLista._get('/users/me', @token)
|
34
43
|
end
|
35
44
|
end
|
36
45
|
end
|
data/lib/dblista/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dblista
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- deepivin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-07-
|
11
|
+
date: 2020-07-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|