Class: Twilio::REST::Proxy::V1::ServiceContext::SessionContext::InteractionInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, session_sid: nil, sid: nil) ⇒ InteractionInstance

Initialize the InteractionInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this Interaction resource.

  • sid (String) (defaults to: nil) —

    The SID of the Call resource to fetch.



424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 424

def initialize(version, payload , service_sid: nil, session_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'session_sid' => payload['session_sid'],
        'service_sid' => payload['service_sid'],
        'account_sid' => payload['account_sid'],
        'data' => payload['data'],
        'type' => payload['type'],
        'inbound_participant_sid' => payload['inbound_participant_sid'],
        'inbound_resource_sid' => payload['inbound_resource_sid'],
        'inbound_resource_status' => payload['inbound_resource_status'],
        'inbound_resource_type' => payload['inbound_resource_type'],
        'inbound_resource_url' => payload['inbound_resource_url'],
        'outbound_participant_sid' => payload['outbound_participant_sid'],
        'outbound_resource_sid' => payload['outbound_resource_sid'],
        'outbound_resource_status' => payload['outbound_resource_status'],
        'outbound_resource_type' => payload['outbound_resource_type'],
        'outbound_resource_url' => payload['outbound_resource_url'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sid ⇒ String

Returns The SID of the Account that created the Interaction resource.

Returns:

  • (String) —

    The SID of the Account that created the Interaction resource.



487
488
489
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 487

def 
    @properties['account_sid']
end

#context ⇒ InteractionContext

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

Returns:



460
461
462
463
464
465
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 460

def context
    unless @instance_context
        @instance_context = InteractionContext.new(@version , @params['service_sid'], @params['session_sid'], @params['sid'])
    end
    @instance_context
end

#data ⇒ String

Returns A JSON string that includes the message body of message interactions (e.g. {\"body\": \"hello\"}) or the call duration (when available) of a call (e.g. {\"duration\": \"5\"}).

Returns:

  • (String) —

    A JSON string that includes the message body of message interactions (e.g. {\"body\": \"hello\"}) or the call duration (when available) of a call (e.g. {\"duration\": \"5\"}).



493
494
495
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 493

def data
    @properties['data']
end

#date_created ⇒ Time

Returns The ISO 8601 date and time in GMT when the Interaction was created.

Returns:

  • (Time) —

    The ISO 8601 date and time in GMT when the Interaction was created.



565
566
567
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 565

def date_created
    @properties['date_created']
end

#date_updated ⇒ Time

Returns The ISO 8601 date and time in GMT when the resource was last updated.

Returns:

  • (Time) —

    The ISO 8601 date and time in GMT when the resource was last updated.



571
572
573
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 571

def date_updated
    @properties['date_updated']
end

#delete ⇒ Boolean

Delete the InteractionInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



584
585
586
587
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 584

def delete

    context.delete
end

#fetch ⇒ InteractionInstance

Fetch the InteractionInstance

Returns:



592
593
594
595
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 592

def fetch

    context.fetch
end

#inbound_participant_sid ⇒ String

Returns The SID of the inbound Participant resource.

Returns:

  • (String) —

    The SID of the inbound Participant resource.



505
506
507
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 505

def inbound_participant_sid
    @properties['inbound_participant_sid']
end

#inbound_resource_sid ⇒ String

Returns The SID of the inbound resource; either the Call or Message.

Returns:

  • (String) —

    The SID of the inbound resource; either the Call or Message.



511
512
513
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 511

def inbound_resource_sid
    @properties['inbound_resource_sid']
end

#inbound_resource_status ⇒ ResourceStatus

Returns:

  • (ResourceStatus)


517
518
519
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 517

def inbound_resource_status
    @properties['inbound_resource_status']
end

#inbound_resource_type ⇒ String

Returns The inbound resource type. Can be Call or Message.

Returns:

  • (String) —

    The inbound resource type. Can be Call or Message.



523
524
525
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 523

def inbound_resource_type
    @properties['inbound_resource_type']
end

#inbound_resource_url ⇒ String

Returns The URL of the Twilio inbound resource.

Returns:

  • (String) —

    The URL of the Twilio inbound resource



529
530
531
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 529

def inbound_resource_url
    @properties['inbound_resource_url']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



606
607
608
609
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 606

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

#outbound_participant_sid ⇒ String

Returns The SID of the outbound Participant).

Returns:



535
536
537
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 535

def outbound_participant_sid
    @properties['outbound_participant_sid']
end

#outbound_resource_sid ⇒ String

Returns The SID of the outbound resource; either the Call or Message.

Returns:

  • (String) —

    The SID of the outbound resource; either the Call or Message.



541
542
543
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 541

def outbound_resource_sid
    @properties['outbound_resource_sid']
end

#outbound_resource_status ⇒ ResourceStatus

Returns:

  • (ResourceStatus)


547
548
549
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 547

def outbound_resource_status
    @properties['outbound_resource_status']
end

#outbound_resource_type ⇒ String

Returns The outbound resource type. Can be: Call or Message.

Returns:

  • (String) —

    The outbound resource type. Can be: Call or Message.



553
554
555
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 553

def outbound_resource_type
    @properties['outbound_resource_type']
end

#outbound_resource_url ⇒ String

Returns The URL of the Twilio outbound resource.

Returns:

  • (String) —

    The URL of the Twilio outbound resource.



559
560
561
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 559

def outbound_resource_url
    @properties['outbound_resource_url']
end

#service_sid ⇒ String

Returns The SID of the parent Service resource.

Returns:

  • (String) —

    The SID of the parent Service resource.



481
482
483
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 481

def service_sid
    @properties['service_sid']
end

#session_sid ⇒ String

Returns The SID of the parent Session resource.

Returns:

  • (String) —

    The SID of the parent Session resource.



475
476
477
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 475

def session_sid
    @properties['session_sid']
end

#sid ⇒ String

Returns The unique string that we created to identify the Interaction resource.

Returns:

  • (String) —

    The unique string that we created to identify the Interaction resource.



469
470
471
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 469

def sid
    @properties['sid']
end

#to_s ⇒ Object

Provide a user friendly representation



599
600
601
602
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 599

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

#type ⇒ Type

Returns:

  • (Type)


499
500
501
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 499

def type
    @properties['type']
end

#url ⇒ String

Returns The absolute URL of the Interaction resource.

Returns:

  • (String) —

    The absolute URL of the Interaction resource.



577
578
579
# File 'lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb', line 577

def url
    @properties['url']
end