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

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.



126
127
128
129
130
131
132
133
134
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 126

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



182
183
184
185
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 182

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

#to_sObject

Provide a user friendly representation



175
176
177
178
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 175

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:



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 142

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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    PaymentInstance.new(
        @version,
        payload,
        account_sid: @solution[:account_sid],
        call_sid: @solution[:call_sid],
        sid: @solution[:sid],
    )
end