Skip to content

Instantly share code, notes, and snippets.

@abacha
Last active January 3, 2018 16:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abacha/26a972531cdc7b345243d744b621e689 to your computer and use it in GitHub Desktop.
Save abacha/26a972531cdc7b345243d744b621e689 to your computer and use it in GitHub Desktop.
def import(interfaces, date, kind)
result = {}
interfaces.each do |interface|
url = "http://localhost:6101/import/#{interface}/#{kind}?reference_date=#{date}"
Net::HTTP.get(URI(url))
end
end
def debug(interfaces, date, kind)
result = {}
interfaces.each do |interface|
begin
url = "http://localhost:6101/#{interface}/#{kind}?reference_date=#{date}"
response = Net::HTTP.get(URI(url))
result[interface] = JSON(response)
p "#{interface}/#{kind}: #{result[interface].size}"
rescue
next
end
end
end
def schedule_rentability(date, account)
uri = URI("http://localhost:6105/scheduler")
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
data = { schedule: { reference_date: date, sinacor_accounts: [account] } }
req.body = data.to_json
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
http.request(req)
end
p res.body
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment