Class: EInvoiceAPI::Resources::Documents
- Inherits:
-
Object
- Object
- EInvoiceAPI::Resources::Documents
- Defined in:
- lib/e_invoice_api/resources/documents.rb,
lib/e_invoice_api/resources/documents/ubl.rb,
lib/e_invoice_api/resources/documents/attachments.rb
Defined Under Namespace
Classes: Attachments, Ubl
Instance Attribute Summary collapse
- #attachments ⇒ EInvoiceAPI::Resources::Documents::Attachments readonly
- #ubl ⇒ EInvoiceAPI::Resources::Documents::Ubl readonly
Instance Method Summary collapse
-
#create(allowances: nil, amount_due: nil, attachments: nil, billing_address: nil, billing_address_recipient: nil, charges: nil, currency: nil, customer_address: nil, customer_address_recipient: nil, customer_email: nil, customer_id: nil, customer_name: nil, customer_tax_id: nil, direction: nil, document_type: nil, due_date: nil, invoice_date: nil, invoice_id: nil, invoice_total: nil, items: nil, note: nil, payment_details: nil, payment_term: nil, previous_unpaid_balance: nil, purchase_order: nil, remittance_address: nil, remittance_address_recipient: nil, service_address: nil, service_address_recipient: nil, service_end_date: nil, service_start_date: nil, shipping_address: nil, shipping_address_recipient: nil, state: nil, subtotal: nil, tax_code: nil, tax_details: nil, total_discount: nil, total_tax: nil, vatex: nil, vatex_note: nil, vendor_address: nil, vendor_address_recipient: nil, vendor_email: nil, vendor_name: nil, vendor_tax_id: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Some parameter documentations has been truncated, see Models::DocumentCreateParams for more details.
-
#create_from_pdf(file: , customer_tax_id: nil, vendor_tax_id: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentCreateFromPdfResponse
Create a new invoice or credit note from a PDF file.
-
#delete(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentDeleteResponse
Delete an invoice or credit note.
-
#initialize(client:) ⇒ Documents
constructor
private
A new instance of Documents.
-
#retrieve(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Get an invoice or credit note by ID.
-
#send_(document_id, email: nil, receiver_peppol_id: nil, receiver_peppol_scheme: nil, sender_peppol_id: nil, sender_peppol_scheme: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Send an invoice or credit note via Peppol.
-
#validate(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::UblDocumentValidation
Validate a UBL document according to Peppol BIS Billing 3.0.
Constructor Details
#initialize(client:) ⇒ Documents
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 Documents.
246 247 248 249 250 |
# File 'lib/e_invoice_api/resources/documents.rb', line 246 def initialize(client:) @client = client @attachments = EInvoiceAPI::Resources::Documents::Attachments.new(client: client) @ubl = EInvoiceAPI::Resources::Documents::Ubl.new(client: client) end |
Instance Attribute Details
#attachments ⇒ EInvoiceAPI::Resources::Documents::Attachments (readonly)
7 8 9 |
# File 'lib/e_invoice_api/resources/documents.rb', line 7 def @attachments end |
#ubl ⇒ EInvoiceAPI::Resources::Documents::Ubl (readonly)
10 11 12 |
# File 'lib/e_invoice_api/resources/documents.rb', line 10 def ubl @ubl end |
Instance Method Details
#create(allowances: nil, amount_due: nil, attachments: nil, billing_address: nil, billing_address_recipient: nil, charges: nil, currency: nil, customer_address: nil, customer_address_recipient: nil, customer_email: nil, customer_id: nil, customer_name: nil, customer_tax_id: nil, direction: nil, document_type: nil, due_date: nil, invoice_date: nil, invoice_id: nil, invoice_total: nil, items: nil, note: nil, payment_details: nil, payment_term: nil, previous_unpaid_balance: nil, purchase_order: nil, remittance_address: nil, remittance_address_recipient: nil, service_address: nil, service_address_recipient: nil, service_end_date: nil, service_start_date: nil, shipping_address: nil, shipping_address_recipient: nil, state: nil, subtotal: nil, tax_code: nil, tax_details: nil, total_discount: nil, total_tax: nil, vatex: nil, vatex_note: nil, vendor_address: nil, vendor_address_recipient: nil, vendor_email: nil, vendor_name: nil, vendor_tax_id: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Some parameter documentations has been truncated, see Models::DocumentCreateParams for more details.
Create a new invoice or credit note
116 117 118 119 120 121 122 123 124 125 |
# File 'lib/e_invoice_api/resources/documents.rb', line 116 def create(params = {}) parsed, = EInvoiceAPI::DocumentCreateParams.dump_request(params) @client.request( method: :post, path: "api/documents/", body: parsed, model: EInvoiceAPI::DocumentResponse, options: ) end |
#create_from_pdf(file: , customer_tax_id: nil, vendor_tax_id: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentCreateFromPdfResponse
Create a new invoice or credit note from a PDF file. If the ‘ubl_document’ field is set in the response, it indicates that sufficient details were extracted from the PDF to automatically generate a valid UBL document ready for sending. If ‘ubl_document’ is not set, human intervention may be required to ensure compliance.
184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/e_invoice_api/resources/documents.rb', line 184 def create_from_pdf(params) parsed, = EInvoiceAPI::DocumentCreateFromPdfParams.dump_request(params) query_params = [:customer_tax_id, :vendor_tax_id] @client.request( method: :post, path: "api/documents/pdf", query: parsed.slice(*query_params), headers: {"content-type" => "multipart/form-data"}, body: parsed.except(*query_params), model: EInvoiceAPI::Models::DocumentCreateFromPdfResponse, options: ) end |
#delete(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentDeleteResponse
Delete an invoice or credit note
156 157 158 159 160 161 162 163 |
# File 'lib/e_invoice_api/resources/documents.rb', line 156 def delete(document_id, params = {}) @client.request( method: :delete, path: ["api/documents/%1$s", document_id], model: EInvoiceAPI::Models::DocumentDeleteResponse, options: params[:request_options] ) end |
#retrieve(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Get an invoice or credit note by ID
137 138 139 140 141 142 143 144 |
# File 'lib/e_invoice_api/resources/documents.rb', line 137 def retrieve(document_id, params = {}) @client.request( method: :get, path: ["api/documents/%1$s", document_id], model: EInvoiceAPI::DocumentResponse, options: params[:request_options] ) end |
#send_(document_id, email: nil, receiver_peppol_id: nil, receiver_peppol_scheme: nil, sender_peppol_id: nil, sender_peppol_scheme: nil, request_options: {}) ⇒ EInvoiceAPI::Models::DocumentResponse
Send an invoice or credit note via Peppol
213 214 215 216 217 218 219 220 221 222 |
# File 'lib/e_invoice_api/resources/documents.rb', line 213 def send_(document_id, params = {}) parsed, = EInvoiceAPI::DocumentSendParams.dump_request(params) @client.request( method: :post, path: ["api/documents/%1$s/send", document_id], query: parsed, model: EInvoiceAPI::DocumentResponse, options: ) end |
#validate(document_id, request_options: {}) ⇒ EInvoiceAPI::Models::UblDocumentValidation
Validate a UBL document according to Peppol BIS Billing 3.0
234 235 236 237 238 239 240 241 |
# File 'lib/e_invoice_api/resources/documents.rb', line 234 def validate(document_id, params = {}) @client.request( method: :post, path: ["api/documents/%1$s/validate", document_id], model: EInvoiceAPI::UblDocumentValidation, options: params[:request_options] ) end |