Class: EInvoiceAPI::Resources::Documents::Ubl

Inherits:
Object
  • Object
show all
Defined in:
lib/e_invoice_api/resources/documents/ubl.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Ubl

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Ubl.

Parameters:



51
52
53
# File 'lib/e_invoice_api/resources/documents/ubl.rb', line 51

def initialize(client:)
  @client = client
end

Instance Method Details

#create_from_ubl(file: , request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse

Create a new invoice or credit note from a UBL file

Parameters:

Returns:

See Also:



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/e_invoice_api/resources/documents/ubl.rb', line 17

def create_from_ubl(params)
  parsed, options = EInvoiceAPI::Documents::UblCreateFromUblParams.dump_request(params)
  @client.request(
    method: :post,
    path: "api/documents/ubl",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: EInvoiceAPI::DocumentResponse,
    options: options
  )
end

#get(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::Documents::UblGetResponse

Get the UBL for an invoice or credit note

Parameters:

Returns:

See Also:



39
40
41
42
43
44
45
46
# File 'lib/e_invoice_api/resources/documents/ubl.rb', line 39

def get(document_id, params = {})
  @client.request(
    method: :get,
    path: ["api/documents/%1$s/ubl", document_id],
    model: EInvoiceAPI::Models::Documents::UblGetResponse,
    options: params[:request_options]
  )
end