Class: Infrawrench::CreditsNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.credits

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CreditsNamespace

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 CreditsNamespace.

Parameters:



5255
5256
5257
# File 'lib/infrawrench/client.rb', line 5255

def initialize(transport)
  @transport = transport
end

Instance Method Details

#get(org_id: nil, request_options: nil) ⇒ Hash

Prepaid credit balances, burn rate and runway

Every prepaid pot the organization holds, most urgent first. A provider that bills in arrears sends an invoice you can argue with; a prepaid pot that empties simply stops answering — so this is an availability number as much as a finance one.

The burn rate is measured from the server's own series of readings rather than reported by the provider, and it is the sum of the decreases between consecutive readings: a top-up inside the window is recorded separately, never netted off. The runway is bounded by both the burn and the credit's own expiry, whichever comes first.

Only providers that expose a balance appear here; most bill in arrears and have no pot.

Requires permission: costs:read.

GET /api/org/orgId/credits

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as CreditBurndown — see sig/infrawrench/sdk.rbs.

Raises:



5284
5285
5286
5287
5288
5289
5290
5291
# File 'lib/infrawrench/client.rb', line 5284

def get(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/credits",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end