Class: EInvoiceAPI::Resources::Documents::Attachments
- Inherits:
-
Object
- Object
- EInvoiceAPI::Resources::Documents::Attachments
- Defined in:
- lib/e_invoice_api/resources/documents/attachments.rb
Instance Method Summary collapse
- #add(document_id, file:, request_options: {}) ⇒ EInvoiceAPI::Models::Documents::DocumentAttachment deprecated Deprecated.
-
#delete(attachment_id, document_id:, request_options: {}) ⇒ EInvoiceAPI::Models::Documents::AttachmentDeleteResponse
Delete an attachment from an invoice or credit note.
-
#initialize(client:) ⇒ Attachments
constructor
private
A new instance of Attachments.
-
#list(document_id, request_options: {}) ⇒ Array<EInvoiceAPI::Models::Documents::DocumentAttachment>
Get all attachments for an invoice or credit note.
-
#retrieve(attachment_id, document_id:, request_options: {}) ⇒ EInvoiceAPI::Models::Documents::DocumentAttachment
Get attachment details with for an invoice or credit note with link to download file (signed URL, valid for 1 hour).
Constructor Details
#initialize(client:) ⇒ Attachments
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 Attachments.
108 109 110 |
# File 'lib/e_invoice_api/resources/documents/attachments.rb', line 108 def initialize(client:) @client = client end |
Instance Method Details
#add(document_id, file:, request_options: {}) ⇒ EInvoiceAPI::Models::Documents::DocumentAttachment
Add one or more attachments to an invoice. Be careful: the attachments ARE NOT ADDED to the UBL! They are only stored in our database and can be downloaded later. To add attachments to the UBL, you need to add the attachment(s) via POST /api/documents
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/e_invoice_api/resources/documents/attachments.rb', line 93 def add(document_id, params) parsed, = EInvoiceAPI::Documents::AttachmentAddParams.dump_request(params) @client.request( method: :post, path: ["api/documents/%1$s/attachments", document_id], headers: {"content-type" => "multipart/form-data"}, body: parsed, model: EInvoiceAPI::Documents::DocumentAttachment, options: ) end |
#delete(attachment_id, document_id:, request_options: {}) ⇒ EInvoiceAPI::Models::Documents::AttachmentDeleteResponse
Delete an attachment from an invoice or credit note
63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/e_invoice_api/resources/documents/attachments.rb', line 63 def delete(, params) parsed, = EInvoiceAPI::Documents::AttachmentDeleteParams.dump_request(params) document_id = parsed.delete(:document_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["api/documents/%1$s/attachments/%2$s", document_id, ], model: EInvoiceAPI::Models::Documents::AttachmentDeleteResponse, options: ) end |
#list(document_id, request_options: {}) ⇒ Array<EInvoiceAPI::Models::Documents::DocumentAttachment>
Get all attachments for an invoice or credit note
43 44 45 46 47 48 49 50 |
# File 'lib/e_invoice_api/resources/documents/attachments.rb', line 43 def list(document_id, params = {}) @client.request( method: :get, path: ["api/documents/%1$s/attachments", document_id], model: EInvoiceAPI::Internal::Type::ArrayOf[EInvoiceAPI::Documents::DocumentAttachment], options: params[:request_options] ) end |
#retrieve(attachment_id, document_id:, request_options: {}) ⇒ EInvoiceAPI::Models::Documents::DocumentAttachment
Get attachment details with for an invoice or credit note with link to download file (signed URL, valid for 1 hour)
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/e_invoice_api/resources/documents/attachments.rb', line 19 def retrieve(, params) parsed, = EInvoiceAPI::Documents::AttachmentRetrieveParams.dump_request(params) document_id = parsed.delete(:document_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["api/documents/%1$s/attachments/%2$s", document_id, ], model: EInvoiceAPI::Documents::DocumentAttachment, options: ) end |