Class: Stripe::InvoiceLineItemService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::InvoiceLineItemService
- Defined in:
- lib/stripe/services/invoice_line_item_service.rb
Instance Method Summary collapse
-
#list(invoice, params = {}, opts = {}) ⇒ Object
When retrieving an invoice, you’ll get a lines property containing the total count of line items and the first handful of those items.
-
#serialize_batch_update(invoice, line_item_id, params = {}, opts = {}) ⇒ Object
Serializes an InvoiceLineItem update request into a batch job JSONL line.
-
#update(invoice, line_item_id, params = {}, opts = {}) ⇒ Object
Updates an invoice’s line item.
Methods inherited from StripeService
#initialize, #request, #request_stream
Constructor Details
This class inherits a constructor from Stripe::StripeService
Instance Method Details
#list(invoice, params = {}, opts = {}) ⇒ Object
When retrieving an invoice, you’ll get a lines property containing the total count of line items and the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
7 8 9 10 11 12 13 14 15 |
# File 'lib/stripe/services/invoice_line_item_service.rb', line 7 def list(invoice, params = {}, opts = {}) request( method: :get, path: format("/v1/invoices/%<invoice>s/lines", { invoice: CGI.escape(invoice) }), params: params, opts: opts, base_address: :api ) end |
#serialize_batch_update(invoice, line_item_id, params = {}, opts = {}) ⇒ Object
Serializes an InvoiceLineItem update request into a batch job JSONL line.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/stripe/services/invoice_line_item_service.rb', line 18 def serialize_batch_update(invoice, line_item_id, params = {}, opts = {}) request_id = SecureRandom.uuid stripe_version = opts[:stripe_version] || Stripe.api_version request_body = { id: request_id, params: params, stripe_version: stripe_version, } request_body[:path_params] = { invoice: invoice, line_item_id: line_item_id } request_body[:context] = opts[:stripe_context] if opts[:stripe_context] JSON.generate(request_body) end |
#update(invoice, line_item_id, params = {}, opts = {}) ⇒ Object
Updates an invoice’s line item. Some fields, such as tax_amounts, only live on the invoice line item, so they can only be updated through this endpoint. Other fields, such as amount, live on both the invoice item and the invoice line item, so updates on this endpoint will propagate to the invoice item as well. Updating an invoice’s line item is only possible before the invoice is finalized.
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/stripe/services/invoice_line_item_service.rb', line 36 def update(invoice, line_item_id, params = {}, opts = {}) params = ::Stripe::InvoiceLineItemUpdateParams.coerce_params(params) unless params.is_a?(Stripe::RequestParams) request( method: :post, path: format("/v1/invoices/%<invoice>s/lines/%<line_item_id>s", { invoice: CGI.escape(invoice), line_item_id: CGI.escape(line_item_id) }), params: params, opts: opts, base_address: :api ) end |