mirror of
https://github.com/internetee/registry.git
synced 2025-08-03 16:32:04 +02:00
30 lines
804 B
Ruby
30 lines
804 B
Ruby
module EisBilling
|
|
class SendDataToDirecto < EisBilling::Base
|
|
def self.send_request(object_data:, monthly:, dry:)
|
|
base_request(object_data: object_data, monthly: monthly, dry: dry)
|
|
end
|
|
|
|
def self.base_request(object_data:, monthly:, dry:)
|
|
prepared_data = {
|
|
invoice_data: object_data,
|
|
monthly: monthly,
|
|
dry: dry,
|
|
initiator: 'registry'
|
|
}
|
|
|
|
uri = URI(invoice_generator_url)
|
|
http = Net::HTTP.new(uri.host, uri.port)
|
|
headers = {
|
|
'Authorization' => 'Bearer foobar',
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => TOKEN
|
|
}
|
|
|
|
http.post(invoice_generator_url, prepared_data.to_json, headers)
|
|
end
|
|
|
|
def self.invoice_generator_url
|
|
"#{BASE_URL}/api/v1/directo/directo"
|
|
end
|
|
end
|
|
end
|