zoho_crm 1.0.2 → 1.0.3
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/lib/zoho_crm/version.rb +1 -1
- data/lib/zoho_crm.rb +17 -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: e2013e2d034f5dca54e51a98fdb96ac579beb0fe
|
4
|
+
data.tar.gz: 3bbd6cd32160f0483c3d838ea3c5f0d92298cc5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c012c753753bdd0cbcf8c57f3936a0a553cac5ca3c1e211c4f86ec7d985de87fb4d691007bedae2849f00a2fb8b262b4e9b6e734152a1ce1f40a9df4e08007e
|
7
|
+
data.tar.gz: dd42ad0fdf96506d8927110e23af8756e58e5c8414cc71573e2dbe3c73af2a65b198e54e7abe473106ab9eb76e472e5e690b96e810d9ff95c6a2c88ea929e865
|
data/lib/zoho_crm/version.rb
CHANGED
data/lib/zoho_crm.rb
CHANGED
@@ -3,6 +3,14 @@ require 'httparty'
|
|
3
3
|
|
4
4
|
module ZohoCrm
|
5
5
|
RateLimitExceeded = Class.new(StandardError)
|
6
|
+
|
7
|
+
class AuthenticationFailure < StandardError
|
8
|
+
attr_reader :message
|
9
|
+
def initialize(message)
|
10
|
+
@message = message
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
6
14
|
class Client
|
7
15
|
|
8
16
|
AUTH_URL = "https://accounts.zoho.com/apiauthtoken/nb/create?SCOPE=ZohoCRM/crmapi&"
|
@@ -30,7 +38,7 @@ module ZohoCrm
|
|
30
38
|
response = HTTParty.post(token_url)
|
31
39
|
response_body = response.body
|
32
40
|
auth_info = Hash[response_body.split(" ").map { |str| str.split("=") }]
|
33
|
-
auth_info["AUTHTOKEN"]
|
41
|
+
raise_auth_exception(auth_info["AUTHTOKEN"])
|
34
42
|
end
|
35
43
|
|
36
44
|
def retrieve_contacts(auth_token, from_index, to_index)
|
@@ -192,5 +200,13 @@ module ZohoCrm
|
|
192
200
|
end
|
193
201
|
end
|
194
202
|
|
203
|
+
def raise_auth_exception(token)
|
204
|
+
if token.nil?
|
205
|
+
raise AuthenticationFailure.new("Good gracious! Incorrect credentials or too many active auth tokens")
|
206
|
+
else
|
207
|
+
token
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
195
211
|
end
|
196
212
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zoho_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ciaran Lofts
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|