Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zoholib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gems
zoholib
Commits
b93f9ab7
Commit
b93f9ab7
authored
Nov 26, 2020
by
Jose Ernesto Suarez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix propossal for allow using the sandbox
parent
870d6b52
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
175 additions
and
17 deletions
+175
-17
.gitignore
.gitignore
+1
-0
.rspec_status
.rspec_status
+7
-7
Gemfile.lock
Gemfile.lock
+6
-4
README.md
README.md
+156
-1
authorization_request.rb
lib/zoholib/authorization_request.rb
+1
-1
grant_request.rb
lib/zoholib/grant_request.rb
+1
-1
refresh_request.rb
lib/zoholib/refresh_request.rb
+1
-1
version.rb
lib/zoholib/version.rb
+1
-1
zoho_basic_client.rb
lib/zoholib/zoho_basic_client.rb
+1
-1
No files found.
.gitignore
View file @
b93f9ab7
.DS_Store
.DS_Store
zoholib*.gem
zoholib*.gem
.env
.rspec_status
View file @
b93f9ab7
example_id | status | run_time |
example_id | status | run_time |
----------------------------- | ------ | --------------- |
----------------------------- | ------ | --------------- |
./spec/zoholib_spec.rb[1:1] | passed | 0.00
155
seconds |
./spec/zoholib_spec.rb[1:1] | passed | 0.00
071
seconds |
./spec/zoholib_spec.rb[1:2] | passed | 0.00
156
seconds |
./spec/zoholib_spec.rb[1:2] | passed | 0.00
047
seconds |
./spec/zoholib_spec.rb[1:3:1] | passed | 0.000
96
seconds |
./spec/zoholib_spec.rb[1:3:1] | passed | 0.000
44
seconds |
./spec/zoholib_spec.rb[1:3:2] | passed | 0.000
39
seconds |
./spec/zoholib_spec.rb[1:3:2] | passed | 0.000
06
seconds |
./spec/zoholib_spec.rb[1:3:3] | passed | 0.000
39
seconds |
./spec/zoholib_spec.rb[1:3:3] | passed | 0.000
06
seconds |
./spec/zoholib_spec.rb[1:3:4] | passed | 0.000
29
seconds |
./spec/zoholib_spec.rb[1:3:4] | passed | 0.000
04
seconds |
./spec/zoholib_spec.rb[1:3:5] | passed | 0.000
45
seconds |
./spec/zoholib_spec.rb[1:3:5] | passed | 0.000
04
seconds |
Gemfile.lock
View file @
b93f9ab7
PATH
PATH
remote: .
remote: .
specs:
specs:
zoholib (0.
0.5b
)
zoholib (0.
22
)
http (~> 4.4.0)
http (~> 4.4.0)
httparty (~> 0.18.0)
httparty (~> 0.18.0)
launchy (~> 2.5.0)
launchy (~> 2.5.0)
logger (~> 1.4.2)
logger (~> 1.4.2)
savon (~> 2.12.0)
savon (~> 2.12.1)
wasabi (= 3.5.0)
GEM
GEM
remote: https://rubygems.org/
remote: https://rubygems.org/
...
@@ -69,7 +70,7 @@ GEM
...
@@ -69,7 +70,7 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.2)
rspec-support (3.9.2)
savon (2.12.
0
)
savon (2.12.
1
)
akami (~> 1.2)
akami (~> 1.2)
builder (>= 2.1.2)
builder (>= 2.1.2)
gyoku (~> 1.2)
gyoku (~> 1.2)
...
@@ -96,7 +97,8 @@ DEPENDENCIES
...
@@ -96,7 +97,8 @@ DEPENDENCIES
logger (~> 1.4.2)
logger (~> 1.4.2)
rake (~> 13.0.1)
rake (~> 13.0.1)
rspec (~> 3.0)
rspec (~> 3.0)
savon (~> 2.12.0)
savon (~> 2.12.1)
wasabi (= 3.5.0)
zoholib!
zoholib!
BUNDLED WITH
BUNDLED WITH
...
...
README.md
View file @
b93f9ab7
# Zoho Library
# Zoho Library
In case a new refresh_token is requested, is needed to generate it executing by hand a new authorization request.
This is becausee the ZOHO API opens a browser for manage the authorization, this can't be managed in the background
The AuthorizationRequest class also opens a server for receive the callback with the information.
```
irb> require './zoholib'
irb> options = {:client_id => '1000.W3UX1B57UxxxxxxxxxxxxxMDH',
:client_secret => '9axxxxxxxxxxxxxxdb3d18e',
:scope => "ZohoCRM.modules.ALL,ZohoCRM.coql.read",
:environment => "sandbox"}
irb> z=Wedoops::Zoholib::AuthorizationRequest.new(options)
irb> z.authorize
```
with this result
D,
[
2020-11-25T18:54:29.342094 #15899
]
DEBUG -- : grant token auth: {:environment=>"sandbox", :query=>{:client_id=>"1000.W3UX1B57UxxxxxxxxxxxxxMDH", :client_secret=>"9axxxxxxxxxxxxxxdb3d18e", :scope=>"ZohoCRM.modules.ALL,ZohoCRM.coql.read", :response_type=>"code", :access_type=>"offline", :redirect_uri=>"http://localhost:8000/auth/callback"}, :follow_redirects=>false} response
I,
[
2020-11-25T18:54:29.348050 #15899
]
INFO -- : Reading socket response
I,
[
2020-11-25T18:54:44.036801 #15899
]
INFO -- : GRANT TOKEN: 1000.70fec5d6a4dd2375df96616613d8205e.45603cb37cbd32987edb80d9a48dd38e
I,
[
2020-11-25T18:54:44.746596 #15899
]
INFO -- :
[
HTTParty
]
[
2020-11-25 18:54:44 +0200
]
200 "POST /token" 258
D,
[
2020-11-25T18:54:44.746711 #15899
]
DEBUG -- : grant request:{:query=>{:client_id=>"1000.W3UX1B57UxxxxxxxxxxxxxMDH", :client_secret=>"9axxxxxxxxxxxxxxdb3d18e", :redirect_uri=>"http://localhost:8000/auth/callback", :code=>"1000.70fec5d6a4dd2375df96616613d8205e.45603cb37cbd32987edb80d9a48dd38e", :grant_type=>"authorization_code"}, :logger=>#
<Logger:0x00007f8e261545d0
@
level=
0,
@
progname=
nil,
@
default_formatter=
#<Logger::Formatter:0x00007f8e26154558
@
datetime_format=
nil
>
, @formatter=nil, @logdev=#
<Logger::LogDevice:0x00007f8e261544e0
@
shift_period_suffix=
nil,
@
shift_size=
nil,
@
shift_age=
nil,
@
filename=
nil,
@
dev=
#<IO:<STDOUT
>
>, @mon_owner=nil, @mon_count=0, @mon_mutex=#
<Thread::Mutex:0x00007f8e26154490>
>>} response: {"access_token":"1000.64686e79ebcd77a364bd28b906139d1b.453935f30b299d09087a2b2731543468","refresh_token":"1000.5c516d9e6caf86906bf7249101bxxxxxxxxxxxxxxxx380","api_domain":"https://www.zohoapis.com","token_type":"Bearer","expires_in":3600}
=> {:access_token=>"1000.64686e79ebcd7xxxxxxxxxb.453935f30b299d0908xxxxxxxxx8", :refresh_token=>"1000.5c516d9e6caf86906bf7249101bxxxxxxxxxxxxxxxx380", :api_domain=>"https://www.zohoapis.com", :token_type=>"Bearer", :expires_in=>3600}
now, we are able to initialize a new client with this token for accesing the sandbox
o={:refresh_token=>"1000.5c516d9e6caf86906bf7249101bxxxxxxxxxxxxxxxx380",
2.
5.1 :009 > :client_id => '1000.W3UX1B57UxxxxxxxxxxxxxMDH',
2.
5.1 :010 > :client_secret => '9axxxxxxxxxxxxxxdb3d18e',
2.
5.1 :011 > :scope => "ZohoCRM.modules.ALL,ZohoCRM.coql.read",
2.
5.1 :012 > :environment => "sandbox"}
z=Wedoops::Zoholib::ZohoBasicClient.new(o)
z.read("Contacts/4230509000000362013")
D,
[
2020-11-25T19:00:25.465606 #15899
]
DEBUG -- : Token is still valid
{"data"=>
[
{"Owner"=>
{"name"=>"Zoho Admin",
"id"=>"4230509000000297001",
"email"=>"zoho.admin.ext@adamo.es"},
"Gis_Area"=>nil,
"B2B_Lead_Size"=>nil,
"Direcci_n_Cadmin"=>nil,
"$state"=>"save",
"$process_flow"=>false,
"Street"=>nil,
"id"=>"4230509000000362013",
"Coverage_Search_String"=>nil,
"$approval"=>
{"delegate"=>false, "approve"=>false, "reject"=>false, "resubmit"=>false},
"First_Visited_URL"=>nil,
"Created_Time"=>"2020-11-17T14:34:50+01:00",
"Estado_en_Cadmin"=>nil,
"response_B12"=>nil,
"Permanencia"=>nil,
"Longitude"=>nil,
"Nearest_Coverage"=>nil,
"Offline_Sent_Date"=>nil,
"Que_tiene_contratado"=>nil,
"Adamo_score"=>nil,
"Partner1"=>nil,
"LinkedIn"=>nil,
"Offline_Campaign"=>nil,
"Customer_ID"=>nil,
"Campa_a"=>nil,
"Last_Visited_Time"=>nil,
"Created_By"=>
{"name"=>"Zoho Admin",
"id"=>"4230509000000297001",
"email"=>"zoho.admin.ext@adamo.es"},
"UTM_Medium"=>nil,
"Description"=>nil,
"Customer_status"=>"WebSearch",
"Number_Of_Chats"=>nil,
"Vive_en_Poblaci_n"=>false,
"$review_process"=>{"approve"=>false, "reject"=>false, "resubmit"=>false},
"Average_Time_Spent_Minutes"=>nil,
"Salutation"=>nil,
"Full_Name"=>"Bo Bonnevie",
"RESPUESTA_IMP1"=>nil,
"Account_Name"=>nil,
"Email_Opt_Out"=>false,
"Tipo_accion"=>
[]
,
"Last_Resoluci_n"=>nil,
"Fecha_Evento"=>nil,
"SMS_Campaign"=>nil,
"Mobile"=>nil,
"Territories"=>nil,
"smsmagic4__LeadIdCPY"=>nil,
"smsmagic4__Plain_Phone"=>"638737344",
"Form_URL"=>nil,
"Event_ID"=>nil,
"$orchestration"=>nil,
"Layout"=>{"name"=>"B2C", "id"=>"4230509000000091033"},
"Lead_Source"=>nil,
"CMS_Token"=>nil,
"Tag"=>
[]
,
"Conoze_Adamo_por"=>nil,
"Email"=>"bo.bonnevie.ext@adamo.es",
"$currency_symbol"=>"EUR",
"Cargo_en_la_empresa"=>nil,
"Visitor_Score"=>nil,
"CallType_Sys02"=>nil,
"Latitude"=>nil,
"Accion"=>
[]
,
"Last_Activity_Time"=>nil,
"Unsubscribed_Mode"=>nil,
"Adamo_Address"=>nil,
"Mailing_Date"=>nil,
"Zip_Code"=>nil,
"$approved"=>true,
"Reporting_To"=>nil,
"Not_For_Telesale"=>false,
"Fecha_de_carga"=>nil,
"Days_Visited"=>nil,
"Enlace_Cadmin"=>nil,
"Channel"=>nil,
"$editable"=>true,
"City"=>nil,
"Province"=>nil,
"Full_street"=>nil,
"Matching_Adamo_Appartment"=>nil,
"Lead_Created_Date"=>"2020-11-17T14:00:00+01:00",
"Previous_Distance"=>nil,
"Campaign"=>nil,
"UTM_Content"=>nil,
"ValidPhone"=>false,
"Embajador_Fiberhood"=>false,
"Operator"=>"Marketing",
"UTM_Campaign"=>nil,
"Poblaci_n_Evento"=>nil,
"First_Name"=>"Bo",
"Modified_By"=>
{"name"=>"Zoho Admin",
"id"=>"4230509000000297001",
"email"=>"zoho.admin.ext@adamo.es"},
"$review"=>nil,
"Phone"=>"638737344",
"Adamo_internal_ID"=>"NA",
"Modified_Time"=>"2020-11-17T14:34:50+01:00",
"Distance_nearest_Coverage"=>nil,
"Unsubscribed_Time"=>nil,
"Fiberhood"=>nil,
"First_Visited_Time"=>nil,
"Sabe_de_adamo"=>false,
"Last_Name"=>"Bonnevie",
"$in_merge"=>false,
"Referrer"=>nil,
"Distance_Updated"=>nil,
"UTM_Source"=>nil,
"$approval_state"=>"approved",
"SMS_Sent_Date"=>nil,
"DNI"=>nil}]}
\ No newline at end of file
lib/zoholib/authorization_request.rb
View file @
b93f9ab7
...
@@ -20,7 +20,7 @@ module Wedoops
...
@@ -20,7 +20,7 @@ module Wedoops
@options
=
Hash
.
new
@options
=
Hash
.
new
# environment specific settings
# environment specific settings
if
options
.
has_key?
(
:environment
)
&&
options
[
:environment
]
==
"sandbox"
if
options
.
has_key?
(
:environment
)
&&
options
[
:environment
]
==
"sandbox"
self
.
class
.
base_uri
"https://
sandbox.zohoapis.eu
/oauth/v2/"
self
.
class
.
base_uri
"https://
accounts.zoho.com
/oauth/v2/"
options
.
delete
(
:environment
)
options
.
delete
(
:environment
)
@options
[
:environment
]
=
"sandbox"
@options
[
:environment
]
=
"sandbox"
end
end
...
...
lib/zoholib/grant_request.rb
View file @
b93f9ab7
...
@@ -7,7 +7,7 @@ module Wedoops
...
@@ -7,7 +7,7 @@ module Wedoops
#headers: {"Authorization" => "Token token=\"111\""}
#headers: {"Authorization" => "Token token=\"111\""}
def
initialize
(
options
=
{})
def
initialize
(
options
=
{})
if
options
.
has_key?
(
:environment
)
&&
options
[
:environment
]
==
"sandbox"
if
options
.
has_key?
(
:environment
)
&&
options
[
:environment
]
==
"sandbox"
self
.
class
.
base_uri
"https://
sandbox.zohoapis.eu
/oauth/v2/"
self
.
class
.
base_uri
"https://
accounts.zoho.com
/oauth/v2/"
options
.
delete
(
:environment
)
options
.
delete
(
:environment
)
end
end
...
...
lib/zoholib/refresh_request.rb
View file @
b93f9ab7
...
@@ -15,7 +15,7 @@ module Wedoops
...
@@ -15,7 +15,7 @@ module Wedoops
def
initialize
(
options
=
{})
def
initialize
(
options
=
{})
# environment specific settings
# environment specific settings
if
options
.
has_key?
(
:environment
)
&&
options
[
:environment
]
==
"sandbox"
if
options
.
has_key?
(
:environment
)
&&
options
[
:environment
]
==
"sandbox"
self
.
class
.
base_uri
"https://
sandbox.zohoapis.eu
/oauth/v2/"
self
.
class
.
base_uri
"https://
accounts.zoho.com
/oauth/v2/"
options
.
delete
(
:environment
)
options
.
delete
(
:environment
)
end
end
...
...
lib/zoholib/version.rb
View file @
b93f9ab7
# frozen_string_literal: true
# frozen_string_literal: true
module
Wedoops
module
Wedoops
module
Zoholib
module
Zoholib
VERSION
=
'0.2
2
'
VERSION
=
'0.2
3
'
end
end
end
end
\ No newline at end of file
lib/zoholib/zoho_basic_client.rb
View file @
b93f9ab7
...
@@ -16,7 +16,7 @@ module Wedoops
...
@@ -16,7 +16,7 @@ module Wedoops
def
initialize
(
options
=
{})
def
initialize
(
options
=
{})
# environment specific settings
# environment specific settings
if
options
.
has_key?
(
:environment
)
&&
options
[
:environment
]
==
"sandbox"
if
options
.
has_key?
(
:environment
)
&&
options
[
:environment
]
==
"sandbox"
self
.
class
.
base_uri
"https://sandbox.zohoapis.
eu
/crm/v2/"
self
.
class
.
base_uri
"https://sandbox.zohoapis.
com
/crm/v2/"
end
end
#Es un cliennte basico que trabaja a partir de refresh_tokens
#Es un cliennte basico que trabaja a partir de refresh_tokens
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment