Last active
January 3, 2018 16:14
-
-
Save abacha/26a972531cdc7b345243d744b621e689 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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