Class: Telnyx::Resources::Invoices

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/invoices.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Invoices

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

Parameters:



62
63
64
# File 'lib/telnyx/resources/invoices.rb', line 62

def initialize(client:)
  @client = client
end

Instance Method Details

#list(page_number: nil, page_size: nil, sort: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::InvoiceListResponse>

Retrieve a paginated list of invoices.

Parameters:

Returns:

See Also:



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/telnyx/resources/invoices.rb', line 46

def list(params = {})
  parsed, options = Telnyx::InvoiceListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "invoices",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::InvoiceListResponse,
    options: options
  )
end

#retrieve(id, action: nil, request_options: {}) ⇒ Telnyx::Models::InvoiceRetrieveResponse

Retrieve a single invoice by its unique identifier.

Parameters:

Returns:

See Also:



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/telnyx/resources/invoices.rb', line 19

def retrieve(id, params = {})
  parsed, options = Telnyx::InvoiceRetrieveParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["invoices/%1$s", id],
    query: query,
    model: Telnyx::Models::InvoiceRetrieveResponse,
    options: options
  )
end