Class: Telnyx::Resources::Payment::AutoRechargePrefs

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

Overview

V2 Auto Recharge Preferences API

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ AutoRechargePrefs

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

Parameters:



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

def initialize(client:)
  @client = client
end

Instance Method Details

#list(request_options: {}) ⇒ Telnyx::Models::Payment::AutoRechargePrefListResponse

Returns the payment auto recharge preferences.

Parameters:

Returns:

See Also:



50
51
52
53
54
55
56
57
# File 'lib/telnyx/resources/payment/auto_recharge_prefs.rb', line 50

def list(params = {})
  @client.request(
    method: :get,
    path: "payment/auto_recharge_prefs",
    model: Telnyx::Models::Payment::AutoRechargePrefListResponse,
    options: params[:request_options]
  )
end

#update(enabled: nil, invoice_enabled: nil, preference: nil, recharge_amount: nil, threshold_amount: nil, request_options: {}) ⇒ Telnyx::Models::Payment::AutoRechargePrefUpdateResponse

Some parameter documentations has been truncated, see Models::Payment::AutoRechargePrefUpdateParams for more details.

Update payment auto recharge preferences.

Parameters:

  • enabled (Boolean)

    Whether auto recharge is enabled.

  • invoice_enabled (Boolean)
  • preference (Symbol, Telnyx::Models::Payment::AutoRechargePrefUpdateParams::Preference)

    The payment preference for auto recharge.

  • recharge_amount (String)

    The amount to recharge the account, the actual recharge amount will be the amoun

  • threshold_amount (String)

    The threshold amount at which the account will be recharged.

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

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/telnyx/resources/payment/auto_recharge_prefs.rb', line 30

def update(params = {})
  parsed, options = Telnyx::Payment::AutoRechargePrefUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: "payment/auto_recharge_prefs",
    body: parsed,
    model: Telnyx::Models::Payment::AutoRechargePrefUpdateResponse,
    options: options
  )
end