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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2972f30e7711cc015fc1c42ae076be41e57e429
4
- data.tar.gz: 29f16dd770927f01834d3bf46cdc08cf07139f98
3
+ metadata.gz: ae9c1f6972fdf05566146179e0ed2089934ae3dc
4
+ data.tar.gz: 28098d9c341ada616d2f0a9ba2bbf0727668374e
5
5
  SHA512:
6
- metadata.gz: 12ef526fd2786e604880b1d610743e37579c8d2485fa9637022c6f7e97392d0a8c1c1b2bf50f7404c3f4b3bc0b99e2df58c8b100c5a3630029e7e8624945961f
7
- data.tar.gz: f5601aa0e20f14690359d69e2c1f6c1c25092e2e182d4e967cd23da0a8f9194a7a855ae2152b3ab4f090378ae329891db3eb50ff023ddd8ed971306e8dece285
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
- ## Usage
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.
@@ -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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module ZQuickblox
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
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.6
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-05 00:00:00.000000000 Z
11
+ date: 2016-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler