Class: Twilio::REST::Api::V2010::AccountContext::CallContext::PaymentContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/call/payment.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, call_sid, sid) ⇒ PaymentContext

Initialize the PaymentContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the [Account](www.twilio.com/docs/iam/api/account) that will update the resource.

  • call_sid (String)

    The SID of the call that will update the resource. This should be the same call sid that was used to create payments resource.

  • sid (String)

    The SID of Payments session that needs to be updated.



121
122
123
124
125
126
127
128
129
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 121

def initialize(version, , call_sid, sid)
    super(version)

    # Path Solution
    @solution = { account_sid: , call_sid: call_sid, sid: sid,  }
    @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Payments/#{@solution[:sid]}.json"

    
end

Instance Method Details

#inspectObject

Provide a detailed, user friendly representation



171
172
173
174
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 171

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.PaymentContext #{context}>"
end

#to_sObject

Provide a user friendly representation



164
165
166
167
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 164

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Api.V2010.PaymentContext #{context}>"
end

#update(idempotency_key: nil, status_callback: nil, capture: :unset, status: :unset) ⇒ PaymentInstance

Update the PaymentInstance

Parameters:

Returns:



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 137

def update(
    idempotency_key: nil, 
    status_callback: nil, 
    capture: :unset, 
    status: :unset
)

    data = Twilio::Values.of({
        'IdempotencyKey' => idempotency_key,
        'StatusCallback' => status_callback,
        'Capture' => capture,
        'Status' => status,
    })

    payload = @version.update('POST', @uri, data: data)
    PaymentInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        call_sid: @solution[:call_sid],
        sid: @solution[:sid],
    )
end