Class: ModernTreasury::Resources::Invoices
- Inherits:
-
Object
- Object
- ModernTreasury::Resources::Invoices
- Defined in:
- lib/modern_treasury/resources/invoices.rb,
lib/modern_treasury/resources/invoices/line_items.rb
Defined Under Namespace
Classes: LineItems
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#add_payment_order(payment_order_id, id:, request_options: {}) ⇒ nil
Add a payment order to an invoice.
-
#create(counterparty_id:, due_date:, originating_account_id:, auto_advance: nil, contact_details: nil, counterparty_billing_address: nil, counterparty_shipping_address: nil, currency: nil, description: nil, fallback_payment_method: nil, invoice_line_items: nil, invoicer_address: nil, invoicer_name: nil, metadata: nil, notification_email_addresses: nil, notifications_enabled: nil, payment_effective_date: nil, payment_method: nil, payment_type: nil, receiving_account_id: nil, recipient_email: nil, recipient_name: nil, remind_after_overdue_days: nil, virtual_account_id: nil, request_options: {}) ⇒ ModernTreasury::Models::Invoice
Some parameter documentations has been truncated, see Models::InvoiceCreateParams for more details.
-
#initialize(client:) ⇒ Invoices
constructor
private
A new instance of Invoices.
-
#list(after_cursor: nil, counterparty_id: nil, created_at_end: nil, created_at_start: nil, due_date_end: nil, due_date_start: nil, expected_payment_id: nil, metadata: nil, number: nil, originating_account_id: nil, payment_order_id: nil, per_page: nil, status: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::Invoice>
Some parameter documentations has been truncated, see Models::InvoiceListParams for more details.
-
#retrieve(id, request_options: {}) ⇒ ModernTreasury::Models::Invoice
get invoice.
-
#update(id, contact_details: nil, counterparty_billing_address: nil, counterparty_id: nil, counterparty_shipping_address: nil, currency: nil, description: nil, due_date: nil, fallback_payment_method: nil, invoice_line_items: nil, invoicer_address: nil, invoicer_name: nil, metadata: nil, notification_email_addresses: nil, notifications_enabled: nil, originating_account_id: nil, payment_effective_date: nil, payment_method: nil, payment_type: nil, receiving_account_id: nil, recipient_email: nil, recipient_name: nil, remind_after_overdue_days: nil, status: nil, virtual_account_id: nil, request_options: {}) ⇒ ModernTreasury::Models::Invoice
Some parameter documentations has been truncated, see Models::InvoiceUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Invoices
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 Invoices.
254 255 256 257 |
# File 'lib/modern_treasury/resources/invoices.rb', line 254 def initialize(client:) @client = client @line_items = ModernTreasury::Resources::Invoices::LineItems.new(client: client) end |
Instance Attribute Details
#line_items ⇒ ModernTreasury::Resources::Invoices::LineItems (readonly)
7 8 9 |
# File 'lib/modern_treasury/resources/invoices.rb', line 7 def line_items @line_items end |
Instance Method Details
#add_payment_order(payment_order_id, id:, request_options: {}) ⇒ nil
Add a payment order to an invoice.
237 238 239 240 241 242 243 244 245 246 247 248 249 |
# File 'lib/modern_treasury/resources/invoices.rb', line 237 def add_payment_order(payment_order_id, params) parsed, = ModernTreasury::InvoiceAddPaymentOrderParams.dump_request(params) id = parsed.delete(:id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["api/invoices/%1$s/payment_orders/%2$s", id, payment_order_id], model: NilClass, options: ) end |
#create(counterparty_id:, due_date:, originating_account_id:, auto_advance: nil, contact_details: nil, counterparty_billing_address: nil, counterparty_shipping_address: nil, currency: nil, description: nil, fallback_payment_method: nil, invoice_line_items: nil, invoicer_address: nil, invoicer_name: nil, metadata: nil, notification_email_addresses: nil, notifications_enabled: nil, payment_effective_date: nil, payment_method: nil, payment_type: nil, receiving_account_id: nil, recipient_email: nil, recipient_name: nil, remind_after_overdue_days: nil, virtual_account_id: nil, request_options: {}) ⇒ ModernTreasury::Models::Invoice
Some parameter documentations has been truncated, see Models::InvoiceCreateParams for more details.
create invoice
69 70 71 72 73 74 75 76 77 78 |
# File 'lib/modern_treasury/resources/invoices.rb', line 69 def create(params) parsed, = ModernTreasury::InvoiceCreateParams.dump_request(params) @client.request( method: :post, path: "api/invoices", body: parsed, model: ModernTreasury::Invoice, options: ) end |
#list(after_cursor: nil, counterparty_id: nil, created_at_end: nil, created_at_start: nil, due_date_end: nil, due_date_start: nil, expected_payment_id: nil, metadata: nil, number: nil, originating_account_id: nil, payment_order_id: nil, per_page: nil, status: nil, request_options: {}) ⇒ ModernTreasury::Internal::Page<ModernTreasury::Models::Invoice>
Some parameter documentations has been truncated, see Models::InvoiceListParams for more details.
list invoices
211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/modern_treasury/resources/invoices.rb', line 211 def list(params = {}) parsed, = ModernTreasury::InvoiceListParams.dump_request(params) query = ModernTreasury::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "api/invoices", query: query, page: ModernTreasury::Internal::Page, model: ModernTreasury::Invoice, options: ) end |
#retrieve(id, request_options: {}) ⇒ ModernTreasury::Models::Invoice
get invoice
91 92 93 94 95 96 97 98 |
# File 'lib/modern_treasury/resources/invoices.rb', line 91 def retrieve(id, params = {}) @client.request( method: :get, path: ["api/invoices/%1$s", id], model: ModernTreasury::Invoice, options: params[:request_options] ) end |
#update(id, contact_details: nil, counterparty_billing_address: nil, counterparty_id: nil, counterparty_shipping_address: nil, currency: nil, description: nil, due_date: nil, fallback_payment_method: nil, invoice_line_items: nil, invoicer_address: nil, invoicer_name: nil, metadata: nil, notification_email_addresses: nil, notifications_enabled: nil, originating_account_id: nil, payment_effective_date: nil, payment_method: nil, payment_type: nil, receiving_account_id: nil, recipient_email: nil, recipient_name: nil, remind_after_overdue_days: nil, status: nil, virtual_account_id: nil, request_options: {}) ⇒ ModernTreasury::Models::Invoice
Some parameter documentations has been truncated, see Models::InvoiceUpdateParams for more details.
update invoice
162 163 164 165 166 167 168 169 170 171 |
# File 'lib/modern_treasury/resources/invoices.rb', line 162 def update(id, params = {}) parsed, = ModernTreasury::InvoiceUpdateParams.dump_request(params) @client.request( method: :patch, path: ["api/invoices/%1$s", id], body: parsed, model: ModernTreasury::Invoice, options: ) end |