Commit 967991e3 authored by Jose Ernesto Suarez's avatar Jose Ernesto Suarez

add the leads in the old API for the backend project

parent bc834f13
...@@ -83,6 +83,33 @@ module Wedoops ...@@ -83,6 +83,33 @@ module Wedoops
return resultado_final return resultado_final
end 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 private
def get_params(url,payload) def get_params(url,payload)
......
# frozen_string_literal: true # frozen_string_literal: true
module Wedoops module Wedoops
module Zoholib module Zoholib
VERSION = '0.0.6b' VERSION = '0.0.7b'
end end
end end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment