Module: Dnsimple::Client::Billing

Included in:
BillingService
Defined in:
lib/dnsimple/client/billing.rb

Instance Method Summary collapse

Instance Method Details

#charges(account_id, options = {}) ⇒ Dnsimple::PaginatedResponse<Dnsimple::Struct::Charge> Also known as: list_charges

List the billing charges for the account.

Examples:

List charges in the first page

client.charges.list(1010)

List charges, provide a filter start date

client.charges.list(1010, filter: { start_date: "2023-01-01" })

List charges, provide a sorting policy

client.charges.list(1010, sort: "invoiced:asc")

Parameters:

  • account_id (Integer)

    the account ID

  • options (Hash) (defaults to: {})

    the filtering and sorting options

Options Hash (options):

  • :page (Integer)

    current page (pagination)

  • :per_page (Integer)

    number of entries to return (pagination)

  • :sort (String)

    sorting policy

Returns:

Raises:

See Also:



27
28
29
30
31
# File 'lib/dnsimple/client/billing.rb', line 27

def charges(, options = {})
  response = client.get(Client.versioned("/%s/billing/charges" % []), Options::ListOptions.new(options))

  Dnsimple::PaginatedResponse.new(response, response["data"].map { |r| Struct::Charge.new(r) })
end