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
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the Account that created the 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 date and time in GMT when the resource was created.
-
#date_ended ⇒ Time
The ISO 8601 date when the Session ended.
-
#date_expiry ⇒ Time
The ISO 8601 date when the Session should expire.
-
#date_last_interaction ⇒ Time
The ISO 8601 date when the Session last had an interaction.
-
#date_started ⇒ Time
The ISO 8601 date when the Session started.
-
#date_updated ⇒ Time
The 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 ⇒ String
The URLs of resources related to the Session.
-
#mode ⇒ session.Mode
The Mode of the Session.
-
#participants ⇒ participants
Access the participants.
-
#service_sid ⇒ String
The SID of the resource’s parent Service.
-
#sid ⇒ String
The unique string that identifies the resource.
-
#status ⇒ session.Status
The status of the Session.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#ttl ⇒ String
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, fail_on_participant_conflict: :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
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 341 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'].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, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the Account that created the resource.
394 395 396 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 394 def account_sid @properties['account_sid'] end |
#closed_reason ⇒ String
Returns The reason the Session ended.
436 437 438 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 436 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
373 374 375 376 377 378 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 373 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 date and time in GMT when the resource was created.
454 455 456 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 454 def date_created @properties['date_created'] end |
#date_ended ⇒ Time
Returns The ISO 8601 date when the Session ended.
406 407 408 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 406 def date_ended @properties['date_ended'] end |
#date_expiry ⇒ Time
Returns The ISO 8601 date when the Session should expire.
418 419 420 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 418 def date_expiry @properties['date_expiry'] end |
#date_last_interaction ⇒ Time
Returns The ISO 8601 date when the Session last had an interaction.
412 413 414 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 412 def date_last_interaction @properties['date_last_interaction'] end |
#date_started ⇒ Time
Returns The ISO 8601 date when the Session started.
400 401 402 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 400 def date_started @properties['date_started'] end |
#date_updated ⇒ Time
Returns The ISO 8601 date and time in GMT when the resource was last updated.
460 461 462 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 460 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Delete the SessionInstance
486 487 488 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 486 def delete context.delete end |
#fetch ⇒ SessionInstance
Fetch the SessionInstance
479 480 481 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 479 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
542 543 544 545 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 542 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Proxy.V1.SessionInstance #{values}>" end |
#interactions ⇒ interactions
Access the interactions
522 523 524 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 522 def interactions context.interactions end |
#links ⇒ String
Returns The URLs of resources related to the Session.
472 473 474 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 472 def links @properties['links'] end |
#mode ⇒ session.Mode
Returns The Mode of the Session.
448 449 450 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 448 def mode @properties['mode'] end |
#participants ⇒ participants
Access the participants
529 530 531 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 529 def participants context.participants end |
#service_sid ⇒ String
Returns The SID of the resource’s parent Service.
388 389 390 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 388 def service_sid @properties['service_sid'] end |
#sid ⇒ String
Returns The unique string that identifies the resource.
382 383 384 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 382 def sid @properties['sid'] end |
#status ⇒ session.Status
Returns The status of the Session.
430 431 432 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 430 def status @properties['status'] end |
#to_s ⇒ Object
Provide a user friendly representation
535 536 537 538 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 535 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Proxy.V1.SessionInstance #{values}>" end |
#ttl ⇒ String
Returns When the session will expire.
442 443 444 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 442 def ttl @properties['ttl'] end |
#unique_name ⇒ String
Returns An application-defined string that uniquely identifies the resource.
424 425 426 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 424 def unique_name @properties['unique_name'] end |
#update(date_expiry: :unset, ttl: :unset, status: :unset, fail_on_participant_conflict: :unset) ⇒ SessionInstance
Update the SessionInstance
510 511 512 513 514 515 516 517 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 510 def update(date_expiry: :unset, ttl: :unset, status: :unset, fail_on_participant_conflict: :unset) context.update( date_expiry: date_expiry, ttl: ttl, status: status, fail_on_participant_conflict: fail_on_participant_conflict, ) end |
#url ⇒ String
Returns The absolute URL of the Session resource.
466 467 468 |
# File 'lib/twilio-ruby/rest/proxy/v1/service/session.rb', line 466 def url @properties['url'] end |