Class: Stigg::Resources::V1::Subscriptions::Invoice

Inherits:
Object
  • Object
show all
Defined in:
lib/stigg/resources/v1/subscriptions/invoice.rb

Overview

Operations related to subscriptions

Instance Method Summary collapse

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.

Parameters:



45
46
47
# File 'lib/stigg/resources/v1/subscriptions/invoice.rb', line 45

def initialize(client:)
  @client = client
end

Instance Method Details

#mark_as_paid(id, x_account_id: nil, x_environment_id: nil, request_options: {}) ⇒ Stigg::Models::V1::Subscriptions::InvoiceMarkAsPaidResponse

Some parameter documentations has been truncated, see Models::V1::Subscriptions::InvoiceMarkAsPaidParams for more details.

Marks the latest invoice of a subscription as paid in the billing provider. The invoice must exist and have an OPEN status.

Parameters:

  • id (String)

    The unique identifier of the entity

  • x_account_id (String)

    Account ID — optional when authenticating with a user JWT (Bearer token); falls

  • x_environment_id (String)

    Environment ID — required when authenticating with a user JWT (Bearer token) on

  • request_options (Stigg::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/stigg/resources/v1/subscriptions/invoice.rb', line 28

def mark_as_paid(id, params = {})
  parsed, options = Stigg::V1::Subscriptions::InvoiceMarkAsPaidParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["api/v1/subscriptions/%1$s/invoice/paid", id],
    headers: parsed.transform_keys(
      x_account_id: "x-account-id",
      x_environment_id: "x-environment-id"
    ),
    model: Stigg::Models::V1::Subscriptions::InvoiceMarkAsPaidResponse,
    options: options
  )
end