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
b767dd3c
Commit
b767dd3c
authored
Jul 03, 2020
by
Jose Ernesto Suarez
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/new-adamo-api' into 'master'
Feat/new adamo api See merge request
!5
parents
12795746
c170bffc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
1 deletion
+72
-1
TO-DO
TO-DO
+3
-1
adamo2_client.rb
lib/zoholib/adamo2_client.rb
+42
-0
adamo_client.rb
lib/zoholib/adamo_client.rb
+27
-0
No files found.
TO-DO
View file @
b767dd3c
- Controlar el error cuando se hace el login con refresh_token y scopes
- Añadir la consulta de settings https://www.zoho.com/crm/developer/docs/api/modules-api.html
\ No newline at end of file
- Añadir la consulta de settings https://www.zoho.com/crm/developer/docs/api/modules-api.html
-Controlar los errores 201
-Añadir el mock con la libreria del robe
\ No newline at end of file
lib/zoholib/adamo2_client.rb
0 → 100644
View file @
b767dd3c
require
'httparty'
require
'pp'
require
'json'
require
'logger'
require
'date'
module
Wedoops
module
Zoholib
class
Adamo2Client
include
HTTParty
debug_output
$stdout
base_uri
'https://zoho-adaptor-staging.adamo.es/'
http_proxy
"prx.wedoops.io"
,
"443"
,
"adamo"
,
"fSJxGqibztyvGPb9"
attr_reader
:subdomain
,
:uri
def
initialize
@logger
=
::
Logger
.
new
(
STDOUT
)
set_key
end
def
search
(
phone
)
self
.
class
.
get
(
"/v1/leads/phone/
#{
phone
}
"
,
headers
:{
'Content-Type'
=>
'application/json'
,
'x-apikey'
=>
"
#{
@key
}
"
})
end
private
def
set_key
@password
=
'ZnsVmfSZwxq7KH1FquCIG8P9UrKDixHRAhci4UuYpRdzZ'
@salt
=
(
DateTime
.
now
.
strftime
(
"%s"
).
to_i
/
86400
).
to_s
@key
=
Digest
::
SHA1
.
hexdigest
(
@password
+
@salt
)
end
def
valid_key?
set_key
if
@key
.
nil?
@key
==
Digest
::
SHA1
.
hexdigest
(
@password
+
@salt
)
end
end
end
end
\ No newline at end of file
lib/zoholib/adamo_client.rb
View file @
b767dd3c
...
...
@@ -83,6 +83,33 @@ module Wedoops
return
resultado_final
end
def
leads
page
=
1
limit
=
50000
#date=Date.today.prev_day.strftime("%Y%m%d")
date
=
Date
.
parse
(
"01-01-2011"
).
strftime
(
"%Y%m%d"
)
resultado_final
=
Array
.
new
r
=
Array
.
new
loop
do
print
"
#{
page
}
"
url
=
"https://coverage-dump.adamo.es/v1/leads/
#{
page
}
?limit=
#{
limit
}
&date=
#{
date
}
"
#.use(logging: {logger: @logger})
resultado
=
HTTP
.
timeout
(
connect:
15
,
read:
30
)
.
headers
(
"cache-control"
=>
"no-cache"
,
"accept"
=>
"application/json"
,
"postman-token"
=>
"8b126eb1-0de6-4a10-d78d-1fb417fb23b0"
,
"x-apikey"
=>
"zYkWN38SYH6hr2Ixq75xvDENl6hrYOvxx0FxLvPD7BUe6"
).
get
(
url
)
r
=
JSON
.
parse
(
resultado
,
symbolize_names:
true
)
resultado_final
.
concat
(
r
)
page
+=
1
print
"(
#{
r
.
size
}
/
#{
resultado_final
.
size
}
),"
break
if
r
.
size
<
limit
||
page
>
2
end
puts
resultado_final
.
size
return
resultado_final
end
private
def
get_params
(
url
,
payload
)
...
...
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