Commit a44b9b10 authored by Chantal's avatar Chantal

allow choosing the project import date

parent d08be82b
...@@ -89,16 +89,39 @@ module Wedoops ...@@ -89,16 +89,39 @@ module Wedoops
end end
def projects def projects(date=nil)
page=1 page=1
limit=50000 limit=50000
#date=Date.today.prev_day.strftime("%Y%m%d") date=Date.today.prev_day.strftime("%Y%m%d") if date.nil?
date=Date.parse("01-01-2011").strftime("%Y%m%d") date=Date.parse(date).strftime("%Y%m%d") unless date.nil?
resultado_final=Array.new resultado_final=Array.new
r=Array.new r=Array.new
loop do loop do
print "#{page} " print "#{page}"
#&date=#{date} url= "https://coverage-dump.adamo.es/v1/cobertura-project/#{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
end
puts resultado_final.size
return resultado_final
end
def all_projects
page=1
limit=50000
resultado_final=Array.new
r=Array.new
loop do
print "#{page}"
url= "https://coverage-dump.adamo.es/v1/cobertura-project/#{page}?limit=#{limit}" url= "https://coverage-dump.adamo.es/v1/cobertura-project/#{page}?limit=#{limit}"
#.use(logging: {logger: @logger}) #.use(logging: {logger: @logger})
resultado= HTTP.timeout(connect: 15, read: 30) resultado= HTTP.timeout(connect: 15, read: 30)
......
# frozen_string_literal: true # frozen_string_literal: true
module Wedoops module Wedoops
module Zoholib module Zoholib
VERSION = '0.6.0' VERSION = '0.7.0'
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