Improve bulk renew tests

This commit is contained in:
Karl Erik Õunapuu 2020-12-21 14:19:27 +02:00
parent 66114aa648
commit 04944b8ac4
No known key found for this signature in database
GPG key ID: C9DD647298A34764
6 changed files with 62 additions and 35 deletions

11
app/models/repp_api.rb Normal file
View file

@ -0,0 +1,11 @@
class ReppApi
def self.bulk_renew(domains, period, registrar)
payload = { domains: domains, renew_period: period }
token = Base64.urlsafe_encode64("#{registrar.username}:#{registrar.plain_text_password}")
headers = { Authorization: "Basic #{token}" }
RestClient.post("#{ENV['repp_url']}domains/renew/bulk", payload, headers)
rescue RestClient::ExceptionWithResponse => e
e.response
end
end