class Twilio::REST::Proxy::V1::ServiceContext::SessionInstance

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Public Class Methods

new(version, payload, service_sid: nil, sid: nil) click to toggle source

Initialize the SessionInstance @param [Version] version Version that contains the resource @param [Hash] payload payload that contains response from Twilio @param [String] service_sid The SID of the

{Service}[https://www.twilio.com/docs/proxy/api/service] the session is
associated with.

@param [String] sid The Twilio-provided string that uniquely identifies the

Session resource to fetch.

@return [SessionInstance] SessionInstance

Calls superclass method Twilio::REST::InstanceResource::new
    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
343 def initialize(version, payload, service_sid: nil, sid: nil)
344   super(version)
345 
346   # Marshaled Properties
347   @properties = {
348       'sid' => payload['sid'],
349       'service_sid' => payload['service_sid'],
350       'account_sid' => payload['account_sid'],
351       'date_started' => Twilio.deserialize_iso8601_datetime(payload['date_started']),
352       'date_ended' => Twilio.deserialize_iso8601_datetime(payload['date_ended']),
353       'date_last_interaction' => Twilio.deserialize_iso8601_datetime(payload['date_last_interaction']),
354       'date_expiry' => Twilio.deserialize_iso8601_datetime(payload['date_expiry']),
355       'unique_name' => payload['unique_name'],
356       'status' => payload['status'],
357       'closed_reason' => payload['closed_reason'],
358       'ttl' => payload['ttl'].to_i,
359       'mode' => payload['mode'],
360       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
361       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
362       'url' => payload['url'],
363       'links' => payload['links'],
364   }
365 
366   # Context
367   @instance_context = nil
368   @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
369 end

Public Instance Methods

account_sid() click to toggle source

@return [String] The SID of the Account that created the resource

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
396 def account_sid
397   @properties['account_sid']
398 end
closed_reason() click to toggle source

@return [String] The reason the Session ended

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
438 def closed_reason
439   @properties['closed_reason']
440 end
context() click to toggle source

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [SessionContext] SessionContext for this SessionInstance

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
375 def context
376   unless @instance_context
377     @instance_context = SessionContext.new(@version, @params['service_sid'], @params['sid'], )
378   end
379   @instance_context
380 end
date_created() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was created

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
456 def date_created
457   @properties['date_created']
458 end
date_ended() click to toggle source

@return [Time] The ISO 8601 date when the Session ended

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
408 def date_ended
409   @properties['date_ended']
410 end
date_expiry() click to toggle source

@return [Time] The ISO 8601 date when the Session should expire

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
420 def date_expiry
421   @properties['date_expiry']
422 end
date_last_interaction() click to toggle source

@return [Time] The ISO 8601 date when the Session last had an interaction

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
414 def date_last_interaction
415   @properties['date_last_interaction']
416 end
date_started() click to toggle source

@return [Time] The ISO 8601 date when the Session started

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
402 def date_started
403   @properties['date_started']
404 end
date_updated() click to toggle source

@return [Time] The ISO 8601 date and time in GMT when the resource was last updated

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
462 def date_updated
463   @properties['date_updated']
464 end
delete() click to toggle source

Delete the SessionInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
488 def delete
489   context.delete
490 end
fetch() click to toggle source

Fetch the SessionInstance @return [SessionInstance] Fetched SessionInstance

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
481 def fetch
482   context.fetch
483 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
545 def inspect
546   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
547   "<Twilio.Proxy.V1.SessionInstance #{values}>"
548 end
interactions() click to toggle source

Access the interactions @return [interactions] interactions

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
525 def interactions
526   context.interactions
527 end
mode() click to toggle source

@return [session.Mode] The Mode of the Session

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
450 def mode
451   @properties['mode']
452 end
participants() click to toggle source

Access the participants @return [participants] participants

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
532 def participants
533   context.participants
534 end
service_sid() click to toggle source

@return [String] The SID of the resource's parent Service

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
390 def service_sid
391   @properties['service_sid']
392 end
sid() click to toggle source

@return [String] The unique string that identifies the resource

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
384 def sid
385   @properties['sid']
386 end
status() click to toggle source

@return [session.Status] The status of the Session

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
432 def status
433   @properties['status']
434 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
538 def to_s
539   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
540   "<Twilio.Proxy.V1.SessionInstance #{values}>"
541 end
ttl() click to toggle source

@return [String] When the session will expire

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
444 def ttl
445   @properties['ttl']
446 end
unique_name() click to toggle source

@return [String] An application-defined string that uniquely identifies the resource

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
426 def unique_name
427   @properties['unique_name']
428 end
update(date_expiry: :unset, ttl: :unset, status: :unset, fail_on_participant_conflict: :unset) click to toggle source

Update the SessionInstance @param [Time] date_expiry The ISO 8601

date when the Session should expire. If this is value is present, it overrides
the `ttl` value.

@param [String] ttl The time, in seconds, when the session will expire. The time

is measured from the last Session create or the Session's last Interaction.

@param [session.Status] status The new status of the resource. Can be:

`in-progress` to re-open a session or `closed` to close a session.

@param [Boolean] fail_on_participant_conflict [Experimental] For accounts with

the ProxyAllowParticipantConflict account flag, setting to true enables
per-request opt-in to allowing Proxy to return a 400 error (Twilio error code
80604) when a request to set a Session to in-progress would cause Participants
with the same Identifier/ProxyIdentifier pair to be active in multiple Sessions.
If not provided, requests will be allowed to succeed, and a Debugger
notification (80801) will be emitted. Having multiple, active Participants with
the same Identifier/ProxyIdentifier pair causes calls and messages from affected
Participants to be routed incorrectly. Please note, the default behavior for
accounts without the ProxyAllowParticipantConflict flag is to reject the request
as described.  This will eventually be the default for all accounts.

@return [SessionInstance] Updated SessionInstance

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
513 def update(date_expiry: :unset, ttl: :unset, status: :unset, fail_on_participant_conflict: :unset)
514   context.update(
515       date_expiry: date_expiry,
516       ttl: ttl,
517       status: status,
518       fail_on_participant_conflict: fail_on_participant_conflict,
519   )
520 end
url() click to toggle source

@return [String] The absolute URL of the Session resource

    # File lib/twilio-ruby/rest/proxy/v1/service/session.rb
468 def url
469   @properties['url']
470 end