Class: Twilio::REST::Proxy::V1::ServiceContext::SessionInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Proxy::V1::ServiceContext::SessionInstance
- Defined in:
- lib/twilio-ruby/rest/proxy/v1/service/session.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Session resource.
-
#closed_reason ⇒ String
The reason the Session ended.
-
#context ⇒ SessionContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created.
-
#date_ended ⇒ Time
The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date when the Session ended.
-
#date_expiry ⇒ Time
The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date when the Session should expire.
-
#date_last_interaction ⇒ Time
The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date when the Session last had an interaction.
-
#date_started ⇒ Time
The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date when the Session started.
-
#date_updated ⇒ Time
The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated.
-
#delete ⇒ Boolean
Delete the SessionInstance.
-
#fetch ⇒ SessionInstance
Fetch the SessionInstance.
-
#initialize(version, payload, service_sid: nil, sid: nil) ⇒ SessionInstance
constructor
Initialize the SessionInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#interactions ⇒ interactions
Access the interactions.
-
#links ⇒ Hash
The URLs of resources related to the Session.
- #mode ⇒ Mode
-
#participants ⇒ participants
Access the participants.
-
#service_sid ⇒ String
The SID of the [Service](www.twilio.com/docs/proxy/api/service) the session is associated with.
-
#sid ⇒ String
The unique string that we created to identify the Session resource.
- #status ⇒ Status
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#ttl ⇒ String
The time, in seconds, when the session will expire.
-
#unique_name ⇒ String
An application-defined string that uniquely identifies the resource.
-
#update(date_expiry: :unset, ttl: :unset, status: :unset) ⇒ SessionInstance
Update the SessionInstance.
-
#url ⇒ String
The absolute URL of the Session resource.
Constructor Details
#initialize(version, payload, service_sid: nil, sid: nil) ⇒ SessionInstance
Initialize the SessionInstance
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 620 def initialize(version, payload , service_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'service_sid' => payload['service_sid'], 'account_sid' => payload['account_sid'], 'date_started' => Twilio.deserialize_iso8601_datetime(payload['date_started']), 'date_ended' => Twilio.deserialize_iso8601_datetime(payload['date_ended']), 'date_last_interaction' => Twilio.deserialize_iso8601_datetime(payload['date_last_interaction']), 'date_expiry' => Twilio.deserialize_iso8601_datetime(payload['date_expiry']), 'unique_name' => payload['unique_name'], 'status' => payload['status'], 'closed_reason' => payload['closed_reason'], 'ttl' => payload['ttl'] == nil ? payload['ttl'] : payload['ttl'].to_i, 'mode' => payload['mode'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'url' => payload['url'], 'links' => payload['links'], } # Context @instance_context = nil @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Session resource.
674 675 676 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 674 def account_sid @properties['account_sid'] end |
#closed_reason ⇒ String
Returns The reason the Session ended.
716 717 718 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 716 def closed_reason @properties['closed_reason'] end |
#context ⇒ SessionContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
653 654 655 656 657 658 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 653 def context unless @instance_context @instance_context = SessionContext.new(@version , @params['service_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created.
734 735 736 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 734 def date_created @properties['date_created'] end |
#date_ended ⇒ Time
Returns The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date when the Session ended.
686 687 688 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 686 def date_ended @properties['date_ended'] end |
#date_expiry ⇒ Time
Returns The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date when the Session should expire. If this is value is present, it overrides the ‘ttl` value.
698 699 700 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 698 def date_expiry @properties['date_expiry'] end |
#date_last_interaction ⇒ Time
Returns The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date when the Session last had an interaction.
692 693 694 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 692 def date_last_interaction @properties['date_last_interaction'] end |
#date_started ⇒ Time
Returns The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date when the Session started.
680 681 682 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 680 def date_started @properties['date_started'] end |
#date_updated ⇒ Time
Returns The [ISO 8601](en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated.
740 741 742 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 740 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the SessionInstance
759 760 761 762 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 759 def delete context.delete end |
#fetch ⇒ SessionInstance
Fetch the SessionInstance
767 768 769 770 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 767 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
814 815 816 817 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 814 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Proxy.V1.SessionInstance #{values}>" end |
#interactions ⇒ interactions
Access the interactions
794 795 796 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 794 def interactions context.interactions end |
#links ⇒ Hash
Returns The URLs of resources related to the Session.
752 753 754 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 752 def links @properties['links'] end |
#mode ⇒ Mode
728 729 730 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 728 def mode @properties['mode'] end |
#participants ⇒ participants
Access the participants
801 802 803 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 801 def participants context.participants end |
#service_sid ⇒ String
Returns The SID of the [Service](www.twilio.com/docs/proxy/api/service) the session is associated with.
668 669 670 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 668 def service_sid @properties['service_sid'] end |
#sid ⇒ String
Returns The unique string that we created to identify the Session resource.
662 663 664 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 662 def sid @properties['sid'] end |
#status ⇒ Status
710 711 712 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 710 def status @properties['status'] end |
#to_s ⇒ Object
Provide a user friendly representation
807 808 809 810 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 807 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Proxy.V1.SessionInstance #{values}>" end |
#ttl ⇒ String
Returns The time, in seconds, when the session will expire. The time is measured from the last Session create or the Session’s last Interaction.
722 723 724 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 722 def ttl @properties['ttl'] end |
#unique_name ⇒ String
Returns An application-defined string that uniquely identifies the resource. This value must be 191 characters or fewer in length and be unique. Supports UTF-8 characters. **This value should not have PII.**.
704 705 706 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 704 def unique_name @properties['unique_name'] end |
#update(date_expiry: :unset, ttl: :unset, status: :unset) ⇒ SessionInstance
Update the SessionInstance
778 779 780 781 782 783 784 785 786 787 788 789 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 778 def update( date_expiry: :unset, ttl: :unset, status: :unset ) context.update( date_expiry: date_expiry, ttl: ttl, status: status, ) end |
#url ⇒ String
Returns The absolute URL of the Session resource.
746 747 748 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 746 def url @properties['url'] end |