Class: Vatsense::Resources::Invoice
- Inherits:
-
Object
- Object
- Vatsense::Resources::Invoice
- Defined in:
- lib/vatsense/resources/invoice.rb,
lib/vatsense/resources/invoice/item.rb
Overview
VAT-compliant invoice management
Defined Under Namespace
Classes: Item
Instance Attribute Summary collapse
-
#item ⇒ Vatsense::Resources::Invoice::Item
readonly
VAT-compliant invoice management.
Instance Method Summary collapse
-
#create(business:, currency_code:, date:, items:, tax_point:, conversion: nil, customer: nil, has_vat: nil, invoice_number: nil, is_copy: nil, is_reverse_charge: nil, notes: nil, pad_invoice_number: nil, serial: nil, tax_type: nil, type: nil, zero_rated: nil, request_options: {}) ⇒ Vatsense::Models::InvoiceResponse
Some parameter documentations has been truncated, see Models::InvoiceCreateParams for more details.
-
#delete(invoice_id, request_options: {}) ⇒ Vatsense::Models::InvoiceDeleteResponse
Permanently delete an invoice.
-
#initialize(client:) ⇒ Invoice
constructor
private
A new instance of Invoice.
-
#list(limit: nil, offset: nil, search: nil, request_options: {}) ⇒ Vatsense::Models::InvoiceListResponse
Retrieve a paginated list of all invoices.
-
#retrieve(invoice_id, request_options: {}) ⇒ Vatsense::Models::InvoiceResponse
Retrieve a specific invoice by its ID.
-
#update(invoice_id, business:, currency_code:, date:, items:, tax_point:, conversion: nil, customer: nil, has_vat: nil, invoice_number: nil, is_copy: nil, is_reverse_charge: nil, notes: nil, pad_invoice_number: nil, serial: nil, tax_type: nil, type: nil, zero_rated: nil, request_options: {}) ⇒ Vatsense::Models::InvoiceResponse
Some parameter documentations has been truncated, see Models::InvoiceUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Invoice
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 Invoice.
200 201 202 203 |
# File 'lib/vatsense/resources/invoice.rb', line 200 def initialize(client:) @client = client @item = Vatsense::Resources::Invoice::Item.new(client: client) end |
Instance Attribute Details
#item ⇒ Vatsense::Resources::Invoice::Item (readonly)
VAT-compliant invoice management
9 10 11 |
# File 'lib/vatsense/resources/invoice.rb', line 9 def item @item end |
Instance Method Details
#create(business:, currency_code:, date:, items:, tax_point:, conversion: nil, customer: nil, has_vat: nil, invoice_number: nil, is_copy: nil, is_reverse_charge: nil, notes: nil, pad_invoice_number: nil, serial: nil, tax_type: nil, type: nil, zero_rated: nil, request_options: {}) ⇒ Vatsense::Models::InvoiceResponse
Some parameter documentations has been truncated, see Models::InvoiceCreateParams for more details.
Create a new VAT-compliant invoice. VAT Sense will automatically calculate the totals based on the items provided.
Not available with sandbox API keys.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vatsense/resources/invoice.rb', line 60 def create(params) parsed, = Vatsense::InvoiceCreateParams.dump_request(params) @client.request( method: :post, path: "invoice", body: parsed, model: Vatsense::InvoiceResponse, options: ) end |
#delete(invoice_id, request_options: {}) ⇒ Vatsense::Models::InvoiceDeleteResponse
Permanently delete an invoice.
188 189 190 191 192 193 194 195 |
# File 'lib/vatsense/resources/invoice.rb', line 188 def delete(invoice_id, params = {}) @client.request( method: :delete, path: ["invoice/%1$s", invoice_id], model: Vatsense::Models::InvoiceDeleteResponse, options: params[:request_options] ) end |
#list(limit: nil, offset: nil, search: nil, request_options: {}) ⇒ Vatsense::Models::InvoiceListResponse
Retrieve a paginated list of all invoices.
165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/vatsense/resources/invoice.rb', line 165 def list(params = {}) parsed, = Vatsense::InvoiceListParams.dump_request(params) query = Vatsense::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "invoice", query: query, model: Vatsense::Models::InvoiceListResponse, options: ) end |
#retrieve(invoice_id, request_options: {}) ⇒ Vatsense::Models::InvoiceResponse
Retrieve a specific invoice by its ID.
82 83 84 85 86 87 88 89 |
# File 'lib/vatsense/resources/invoice.rb', line 82 def retrieve(invoice_id, params = {}) @client.request( method: :get, path: ["invoice/%1$s", invoice_id], model: Vatsense::InvoiceResponse, options: params[:request_options] ) end |
#update(invoice_id, business:, currency_code:, date:, items:, tax_point:, conversion: nil, customer: nil, has_vat: nil, invoice_number: nil, is_copy: nil, is_reverse_charge: nil, notes: nil, pad_invoice_number: nil, serial: nil, tax_type: nil, type: nil, zero_rated: nil, request_options: {}) ⇒ Vatsense::Models::InvoiceResponse
Some parameter documentations has been truncated, see Models::InvoiceUpdateParams for more details.
Update an existing invoice. Only the fields provided will be updated.
139 140 141 142 143 144 145 146 147 148 |
# File 'lib/vatsense/resources/invoice.rb', line 139 def update(invoice_id, params) parsed, = Vatsense::InvoiceUpdateParams.dump_request(params) @client.request( method: :patch, path: ["invoice/%1$s", invoice_id], body: parsed, model: Vatsense::InvoiceResponse, options: ) end |