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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, account_sid: nil, call_sid: nil, sid: nil) ⇒ PaymentInstance

Initialize the PaymentInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String) (defaults to: nil)

    The SID of the Account that created this Payment resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 215

def initialize(version, payload , account_sid: nil, call_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'call_sid' => payload['call_sid'],
        'sid' => payload['sid'],
        'date_created' => Twilio.deserialize_rfc2822(payload['date_created']),
        'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']),
        'uri' => payload['uri'],
    }

    # Context
    @instance_context = nil
    @params = { 'account_sid' =>   ,'call_sid' => call_sid  || @properties['call_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

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

Returns:



246
247
248
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 246

def 
    @properties['account_sid']
end

#call_sidString

Returns The SID of the [Call](www.twilio.com/docs/voice/api/call-resource) the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF.

Returns:

  • (String)

    The SID of the [Call](www.twilio.com/docs/voice/api/call-resource) the Payments resource is associated with. This will refer to the call sid that is producing the payment card (credit/ACH) information thru DTMF.



252
253
254
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 252

def call_sid
    @properties['call_sid']
end

#contextPaymentContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



237
238
239
240
241
242
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 237

def context
    unless @instance_context
        @instance_context = PaymentContext.new(@version , @params['account_sid'], @params['call_sid'], @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT that the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



264
265
266
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 264

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT that the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



270
271
272
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 270

def date_updated
    @properties['date_updated']
end

#inspectObject

Provide a detailed, user friendly representation



311
312
313
314
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 311

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Api.V2010.PaymentInstance #{values}>"
end

#sidString

Returns The SID of the Payments resource.

Returns:

  • (String)

    The SID of the Payments resource.



258
259
260
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 258

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



304
305
306
307
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 304

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Api.V2010.PaymentInstance #{values}>"
end

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

Update the PaymentInstance

Parameters:

Returns:



287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 287

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

    context.update(
        idempotency_key: idempotency_key, 
        status_callback: status_callback, 
        capture: capture, 
        status: status, 
    )
end

#uriString

Returns The URI of the resource, relative to ‘api.twilio.com`.

Returns:

  • (String)

    The URI of the resource, relative to ‘api.twilio.com`.



276
277
278
# File 'lib/twilio-ruby/rest/api/v2010/account/call/payment.rb', line 276

def uri
    @properties['uri']
end