Class: Twilio::REST::Messaging::V1::SessionInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Messaging::V1::SessionInstance
- Defined in:
- lib/twilio-ruby/rest/messaging/v1/session.rb
Overview
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique id of the Account responsible for this session.
-
#attributes ⇒ String
An optional string metadata field you can use to store any data you wish.
-
#context ⇒ SessionContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#created_by ⇒ String
Identity of the session’s creator.
-
#date_created ⇒ Time
The date that this resource was created.
-
#date_updated ⇒ Time
The date that this resource was last updated.
-
#delete ⇒ Boolean
Deletes the SessionInstance.
-
#fetch ⇒ SessionInstance
Fetch a SessionInstance.
-
#friendly_name ⇒ String
The human-readable name of this session.
-
#initialize(version, payload, sid: nil) ⇒ SessionInstance
constructor
Initialize the SessionInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#links ⇒ String
Absolute URLs to access the Participants and Messages for this Session.
-
#messages ⇒ messages
Access the messages.
-
#messaging_service_sid ⇒ String
The unique id of the SMS Service this session belongs to.
-
#participants ⇒ participants
Access the participants.
-
#service_sid ⇒ String
The unique id of the Chat Service this session belongs to.
-
#sid ⇒ String
A 34 character string that uniquely identifies this resource.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset) ⇒ SessionInstance
Update the SessionInstance.
-
#url ⇒ String
An absolute URL for this session.
-
#webhooks ⇒ webhooks
Access the webhooks.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ SessionInstance
Initialize the SessionInstance
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 335 def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'account_sid' => payload['account_sid'], 'service_sid' => payload['service_sid'], 'messaging_service_sid' => payload['messaging_service_sid'], 'friendly_name' => payload['friendly_name'], 'attributes' => payload['attributes'], 'created_by' => payload['created_by'], '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 = {'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The unique id of the Account responsible for this session.
377 378 379 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 377 def account_sid @properties['account_sid'] end |
#attributes ⇒ String
Returns An optional string metadata field you can use to store any data you wish.
401 402 403 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 401 def attributes @properties['attributes'] 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
362 363 364 365 366 367 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 362 def context unless @instance_context @instance_context = SessionContext.new(@version, @params['sid'], ) end @instance_context end |
#created_by ⇒ String
Returns Identity of the session’s creator.
407 408 409 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 407 def created_by @properties['created_by'] end |
#date_created ⇒ Time
Returns The date that this resource was created.
413 414 415 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 413 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date that this resource was last updated.
419 420 421 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 419 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the SessionInstance
445 446 447 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 445 def delete context.delete end |
#fetch ⇒ SessionInstance
Fetch a SessionInstance
438 439 440 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 438 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The human-readable name of this session.
395 396 397 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 395 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
501 502 503 504 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 501 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Messaging.V1.SessionInstance #{values}>" end |
#links ⇒ String
Returns Absolute URLs to access the Participants and Messages for this Session.
431 432 433 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 431 def links @properties['links'] end |
#messages ⇒ messages
Access the messages
481 482 483 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 481 def context. end |
#messaging_service_sid ⇒ String
Returns The unique id of the SMS Service this session belongs to.
389 390 391 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 389 def messaging_service_sid @properties['messaging_service_sid'] end |
#participants ⇒ participants
Access the participants
474 475 476 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 474 def participants context.participants end |
#service_sid ⇒ String
Returns The unique id of the Chat Service this session belongs to.
383 384 385 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 383 def service_sid @properties['service_sid'] end |
#sid ⇒ String
Returns A 34 character string that uniquely identifies this resource.
371 372 373 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 371 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
494 495 496 497 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 494 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Messaging.V1.SessionInstance #{values}>" end |
#update(friendly_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset) ⇒ SessionInstance
Update the SessionInstance
461 462 463 464 465 466 467 468 469 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 461 def update(friendly_name: :unset, attributes: :unset, date_created: :unset, date_updated: :unset, created_by: :unset) context.update( friendly_name: friendly_name, attributes: attributes, date_created: date_created, date_updated: date_updated, created_by: created_by, ) end |
#url ⇒ String
Returns An absolute URL for this session.
425 426 427 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 425 def url @properties['url'] end |
#webhooks ⇒ webhooks
Access the webhooks
488 489 490 |
# File 'lib/twilio-ruby/rest/messaging/v1/session.rb', line 488 def webhooks context.webhooks end |