Class: Stripe::InvoiceItemService

Inherits:
StripeService show all
Defined in:
lib/stripe/services/invoice_item_service.rb

Defined Under Namespace

Classes: CreateParams, DeleteParams, ListParams, RetrieveParams, UpdateParams

Instance Method Summary collapse

Methods inherited from StripeService

#initialize, #request, #request_stream

Constructor Details

This class inherits a constructor from Stripe::StripeService

Instance Method Details

#create(params = {}, opts = {}) ⇒ Object

Creates an item to be added to a draft invoice (up to 250 items per invoice). If no invoice is specified, the item will be on the next invoice created for the customer specified.



341
342
343
344
345
346
347
348
349
# File 'lib/stripe/services/invoice_item_service.rb', line 341

def create(params = {}, opts = {})
  request(
    method: :post,
    path: "/v1/invoiceitems",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#delete(invoiceitem, params = {}, opts = {}) ⇒ Object

Deletes an invoice item, removing it from an invoice. Deleting invoice items is only possible when they’re not attached to invoices, or if it’s attached to a draft invoice.



352
353
354
355
356
357
358
359
360
# File 'lib/stripe/services/invoice_item_service.rb', line 352

def delete(invoiceitem, params = {}, opts = {})
  request(
    method: :delete,
    path: format("/v1/invoiceitems/%<invoiceitem>s", { invoiceitem: CGI.escape(invoiceitem) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#list(params = {}, opts = {}) ⇒ Object

Returns a list of your invoice items. Invoice items are returned sorted by creation date, with the most recently created invoice items appearing first.



363
364
365
366
367
368
369
370
371
# File 'lib/stripe/services/invoice_item_service.rb', line 363

def list(params = {}, opts = {})
  request(
    method: :get,
    path: "/v1/invoiceitems",
    params: params,
    opts: opts,
    base_address: :api
  )
end

#retrieve(invoiceitem, params = {}, opts = {}) ⇒ Object

Retrieves the invoice item with the given ID.



374
375
376
377
378
379
380
381
382
# File 'lib/stripe/services/invoice_item_service.rb', line 374

def retrieve(invoiceitem, params = {}, opts = {})
  request(
    method: :get,
    path: format("/v1/invoiceitems/%<invoiceitem>s", { invoiceitem: CGI.escape(invoiceitem) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end

#update(invoiceitem, params = {}, opts = {}) ⇒ Object

Updates the amount or description of an invoice item on an upcoming invoice. Updating an invoice item is only possible before the invoice it’s attached to is closed.



385
386
387
388
389
390
391
392
393
# File 'lib/stripe/services/invoice_item_service.rb', line 385

def update(invoiceitem, params = {}, opts = {})
  request(
    method: :post,
    path: format("/v1/invoiceitems/%<invoiceitem>s", { invoiceitem: CGI.escape(invoiceitem) }),
    params: params,
    opts: opts,
    base_address: :api
  )
end