zquickblox 0.1.6 → 0.1.7
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/README.md +10 -1
- data/lib/zquickblox/request.rb +2 -2
- data/lib/zquickblox/user.rb +1 -0
- data/lib/zquickblox/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: ae9c1f6972fdf05566146179e0ed2089934ae3dc
|
4
|
+
data.tar.gz: 28098d9c341ada616d2f0a9ba2bbf0727668374e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4555c662e79d6954d3e2804012dcdfe689c4cffb1e7e492c93091c819a518eae1814cd1ddd484f14d057f5e3e4303425bfc19946aa38e9ee4b6ae199806d690
|
7
|
+
data.tar.gz: fe378cf5e460844a3b5340effd6fe8aa874f83518c41347e29cc88a14a1471073a424e08b24eefe39de554749db770b56292cda8608527fd2d59a6c20f0daa15
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
$ gem install zquickblox
|
22
22
|
|
23
|
-
##
|
23
|
+
## Config
|
24
24
|
|
25
25
|
### Rails
|
26
26
|
|
@@ -42,6 +42,8 @@ ZQuickblox.configure do |config|
|
|
42
42
|
end
|
43
43
|
```
|
44
44
|
|
45
|
+
## Usage
|
46
|
+
|
45
47
|
To create a new user, just call:
|
46
48
|
|
47
49
|
```ruby
|
@@ -54,6 +56,13 @@ There are more params for you to set:
|
|
54
56
|
login, password, email, blob_id, external_user_id, facebook_id, twitter_id, full_name, phone, website
|
55
57
|
```
|
56
58
|
|
59
|
+
To get a user by his login, just call:
|
60
|
+
```ruby
|
61
|
+
ZQuickblox::User.find("abc@email.com")
|
62
|
+
```
|
63
|
+
|
64
|
+
The result will be `nil` if the user doesn't exist.
|
65
|
+
|
57
66
|
## Error handling
|
58
67
|
|
59
68
|
During the API processing, errors may occur. In such cases, `ZQuickblox::Error` (subclass of StandardError) will be thrown with `messages` as an array of string error messages.
|
data/lib/zquickblox/request.rb
CHANGED
@@ -34,9 +34,9 @@ module ZQuickblox
|
|
34
34
|
put if @method == :put
|
35
35
|
delete if @method == :delete
|
36
36
|
|
37
|
-
@response_body = JSON.parse(@response.body)
|
37
|
+
@response_body = JSON.parse(@response.body) if @response.status != 404
|
38
38
|
|
39
|
-
@errors = @response_body["errors"]
|
39
|
+
@errors = @response_body["errors"] if @response.status != 404
|
40
40
|
if @errors
|
41
41
|
raise ZQuickblox::Error.new(messages: @errors["base"])
|
42
42
|
end
|
data/lib/zquickblox/user.rb
CHANGED
@@ -16,6 +16,7 @@ module ZQuickblox
|
|
16
16
|
def find(login)
|
17
17
|
request = ZQuickblox::User::FindUserRequest.new(login)
|
18
18
|
run_request(request)
|
19
|
+
return nil if request.response.status == 404
|
19
20
|
user = User.new(ZQuickblox::Util.symbolize_keys(request.response_body["user"]))
|
20
21
|
return user
|
21
22
|
end
|
data/lib/zquickblox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zquickblox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thuong Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|