Class: Telnyx::Resources::BillingGroups

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/billing_groups.rb,
sig/telnyx/resources/billing_groups.rbs

Overview

Billing groups operations

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ BillingGroups

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

Parameters:



121
122
123
# File 'lib/telnyx/resources/billing_groups.rb', line 121

def initialize(client:)
  @client = client
end

Instance Method Details

#create(name: nil, request_options: {}) ⇒ Telnyx::Models::BillingGroupCreateResponse

Create a new billing group, which can be used to organize resources for billing purposes.

Parameters:

  • name (String)

    A name for the billing group

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

Returns:

See Also:



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

def create(params = {})
  parsed, options = Telnyx::BillingGroupCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "billing_groups",
    body: parsed,
    model: Telnyx::Models::BillingGroupCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Telnyx::Models::BillingGroupDeleteResponse

Delete a billing group from your account.

Parameters:

  • id (String)

    The id of the billing group

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

Returns:

See Also:



109
110
111
112
113
114
115
116
# File 'lib/telnyx/resources/billing_groups.rb', line 109

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["billing_groups/%1$s", id],
    model: Telnyx::Models::BillingGroupDeleteResponse,
    options: params[:request_options]
  )
end

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

Retrieve a paginated list of billing groups on your account.

Parameters:

  • page_number (Integer)
  • page_size (Integer)
  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/telnyx/resources/billing_groups.rb', line 85

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

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::BillingGroupRetrieveResponse

Retrieve the details of a specific billing group.

Parameters:

  • id (String)

    The id of the billing group

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

Returns:

See Also:



41
42
43
44
45
46
47
48
# File 'lib/telnyx/resources/billing_groups.rb', line 41

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["billing_groups/%1$s", id],
    model: Telnyx::Models::BillingGroupRetrieveResponse,
    options: params[:request_options]
  )
end

#update(id, name: nil, request_options: {}) ⇒ Telnyx::Models::BillingGroupUpdateResponse

Update the properties of an existing billing group.

Parameters:

  • id (String)

    The id of the billing group

  • name (String)

    A name for the billing group

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

Returns:

See Also:



63
64
65
66
67
68
69
70
71
72
# File 'lib/telnyx/resources/billing_groups.rb', line 63

def update(id, params = {})
  parsed, options = Telnyx::BillingGroupUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["billing_groups/%1$s", id],
    body: parsed,
    model: Telnyx::Models::BillingGroupUpdateResponse,
    options: options
  )
end