Class: Telnyx::Resources::BundlePricing::UserBundles

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ UserBundles

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

Parameters:



178
179
180
# File 'lib/telnyx/resources/bundle_pricing/user_bundles.rb', line 178

def initialize(client:)
  @client = client
end

Instance Method Details

#create(idempotency_key: nil, items: nil, authorization_bearer: nil, request_options: {}) ⇒ Telnyx::Models::BundlePricing::UserBundleCreateResponse

Some parameter documentations has been truncated, see Models::BundlePricing::UserBundleCreateParams for more details.

Creates multiple user bundles for the user.

Parameters:

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/telnyx/resources/bundle_pricing/user_bundles.rb', line 25

def create(params = {})
  parsed, options = Telnyx::BundlePricing::UserBundleCreateParams.dump_request(params)
  header_params = {authorization_bearer: "authorization_bearer"}
  @client.request(
    method: :post,
    path: "bundle_pricing/user_bundles/bulk",
    headers: parsed.slice(*header_params.keys),
    body: parsed.except(*header_params.keys),
    model: Telnyx::Models::BundlePricing::UserBundleCreateResponse,
    options: options
  )
end

#deactivate(user_bundle_id, authorization_bearer: nil, request_options: {}) ⇒ Telnyx::Models::BundlePricing::UserBundleDeactivateResponse

Deactivates a user bundle by its ID.

Parameters:

  • user_bundle_id (String)

    User bundle’s ID, this is used to identify the user bundle in the API.

  • authorization_bearer (String)

    Authenticates the request with your Telnyx API V2 KEY

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

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
# File 'lib/telnyx/resources/bundle_pricing/user_bundles.rb', line 110

def deactivate(user_bundle_id, params = {})
  parsed, options = Telnyx::BundlePricing::UserBundleDeactivateParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["bundle_pricing/user_bundles/%1$s", user_bundle_id],
    headers: parsed,
    model: Telnyx::Models::BundlePricing::UserBundleDeactivateResponse,
    options: options
  )
end

#list(filter: nil, page_number: nil, page_size: nil, authorization_bearer: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::BundlePricing::UserBundle>

Some parameter documentations has been truncated, see Models::BundlePricing::UserBundleListParams for more details.

Get a paginated list of user bundles.

Parameters:

Returns:

See Also:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/telnyx/resources/bundle_pricing/user_bundles.rb', line 82

def list(params = {})
  query_params = [:filter, :page_number, :page_size]
  parsed, options = Telnyx::BundlePricing::UserBundleListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "bundle_pricing/user_bundles",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    headers: parsed.except(*query_params),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::BundlePricing::UserBundle,
    options: options
  )
end

#list_resources(user_bundle_id, authorization_bearer: nil, request_options: {}) ⇒ Telnyx::Models::BundlePricing::UserBundleListResourcesResponse

Retrieves the resources of a user bundle by its ID.

Parameters:

  • user_bundle_id (String)

    User bundle’s ID, this is used to identify the user bundle in the API.

  • authorization_bearer (String)

    Authenticates the request with your Telnyx API V2 KEY

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

Returns:

See Also:



134
135
136
137
138
139
140
141
142
143
# File 'lib/telnyx/resources/bundle_pricing/user_bundles.rb', line 134

def list_resources(user_bundle_id, params = {})
  parsed, options = Telnyx::BundlePricing::UserBundleListResourcesParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["bundle_pricing/user_bundles/%1$s/resources", user_bundle_id],
    headers: parsed,
    model: Telnyx::Models::BundlePricing::UserBundleListResourcesResponse,
    options: options
  )
end

#list_unused(filter: nil, authorization_bearer: nil, request_options: {}) ⇒ Telnyx::Models::BundlePricing::UserBundleListUnusedResponse

Some parameter documentations has been truncated, see Models::BundlePricing::UserBundleListUnusedParams for more details.

Returns all user bundles that aren’t in use.

Parameters:

Returns:

See Also:



161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/telnyx/resources/bundle_pricing/user_bundles.rb', line 161

def list_unused(params = {})
  query_params = [:filter]
  parsed, options = Telnyx::BundlePricing::UserBundleListUnusedParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "bundle_pricing/user_bundles/unused",
    query: query,
    headers: parsed.except(*query_params),
    model: Telnyx::Models::BundlePricing::UserBundleListUnusedResponse,
    options: options
  )
end

#retrieve(user_bundle_id, authorization_bearer: nil, request_options: {}) ⇒ Telnyx::Models::BundlePricing::UserBundleRetrieveResponse

Retrieves a user bundle by its ID.

Parameters:

  • user_bundle_id (String)

    User bundle’s ID, this is used to identify the user bundle in the API.

  • authorization_bearer (String)

    Authenticates the request with your Telnyx API V2 KEY

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

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
# File 'lib/telnyx/resources/bundle_pricing/user_bundles.rb', line 51

def retrieve(user_bundle_id, params = {})
  parsed, options = Telnyx::BundlePricing::UserBundleRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["bundle_pricing/user_bundles/%1$s", user_bundle_id],
    headers: parsed,
    model: Telnyx::Models::BundlePricing::UserBundleRetrieveResponse,
    options: options
  )
end