Class: Twilio::REST::Conversations::V1::ConversationInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Conversations::V1::ConversationInstance
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/conversation.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique ID of the Account responsible for this conversation.
-
#attributes ⇒ String
An optional string metadata field you can use to store any data you wish.
-
#chat_service_sid ⇒ String
The unique ID of the Conversation Service this conversation belongs to.
-
#context ⇒ ConversationContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date that this resource was created.
-
#date_updated ⇒ Time
The date that this resource was last updated.
-
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the ConversationInstance.
-
#fetch ⇒ ConversationInstance
Fetch the ConversationInstance.
-
#friendly_name ⇒ String
The human-readable name of this conversation.
-
#initialize(version, payload, sid: nil) ⇒ ConversationInstance
constructor
Initialize the ConversationInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#links ⇒ String
Absolute URLs to access the participants, messages and webhooks of this conversation.
-
#messages ⇒ messages
Access the messages.
-
#messaging_service_sid ⇒ String
The unique ID of the Messaging Service this conversation belongs to.
-
#participants ⇒ participants
Access the participants.
-
#sid ⇒ String
A 34 character string that uniquely identifies this resource.
-
#state ⇒ conversation.State
Current state of this conversation.
-
#timers ⇒ Hash
Timer date values for this conversation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#unique_name ⇒ String
An application-defined string that uniquely identifies the resource.
-
#update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset, unique_name: :unset, x_twilio_webhook_enabled: :unset) ⇒ ConversationInstance
Update the ConversationInstance.
-
#url ⇒ String
An absolute URL for this conversation.
-
#webhooks ⇒ webhooks
Access the webhooks.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ ConversationInstance
Initialize the ConversationInstance
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 347 def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'chat_service_sid' => payload['chat_service_sid'], 'messaging_service_sid' => payload['messaging_service_sid'], 'sid' => payload['sid'], 'friendly_name' => payload['friendly_name'], 'unique_name' => payload['unique_name'], 'attributes' => payload['attributes'], 'state' => payload['state'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'timers' => payload['timers'], '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 conversation.
385 386 387 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 385 def account_sid @properties['account_sid'] end |
#attributes ⇒ String
Returns An optional string metadata field you can use to store any data you wish.
421 422 423 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 421 def attributes @properties['attributes'] end |
#chat_service_sid ⇒ String
Returns The unique ID of the Conversation Service this conversation belongs to.
391 392 393 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 391 def chat_service_sid @properties['chat_service_sid'] end |
#context ⇒ ConversationContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
376 377 378 379 380 381 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 376 def context unless @instance_context @instance_context = ConversationContext.new(@version, @params['sid'], ) end @instance_context end |
#date_created ⇒ Time
Returns The date that this resource was created.
433 434 435 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 433 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date that this resource was last updated.
439 440 441 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 439 def date_updated @properties['date_updated'] end |
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the ConversationInstance
506 507 508 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 506 def delete(x_twilio_webhook_enabled: :unset) context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) end |
#fetch ⇒ ConversationInstance
Fetch the ConversationInstance
513 514 515 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 513 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The human-readable name of this conversation.
409 410 411 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 409 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
547 548 549 550 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 547 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.ConversationInstance #{values}>" end |
#links ⇒ String
Returns Absolute URLs to access the participants, messages and webhooks of this conversation.
457 458 459 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 457 def links @properties['links'] end |
#messages ⇒ messages
Access the messages
527 528 529 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 527 def context. end |
#messaging_service_sid ⇒ String
Returns The unique ID of the Messaging Service this conversation belongs to.
397 398 399 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 397 def messaging_service_sid @properties['messaging_service_sid'] end |
#participants ⇒ participants
Access the participants
520 521 522 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 520 def participants context.participants end |
#sid ⇒ String
Returns A 34 character string that uniquely identifies this resource.
403 404 405 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 403 def sid @properties['sid'] end |
#state ⇒ conversation.State
Returns Current state of this conversation.
427 428 429 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 427 def state @properties['state'] end |
#timers ⇒ Hash
Returns Timer date values for this conversation.
445 446 447 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 445 def timers @properties['timers'] end |
#to_s ⇒ Object
Provide a user friendly representation
540 541 542 543 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 540 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.ConversationInstance #{values}>" end |
#unique_name ⇒ String
Returns An application-defined string that uniquely identifies the resource.
415 416 417 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 415 def unique_name @properties['unique_name'] end |
#update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset, unique_name: :unset, x_twilio_webhook_enabled: :unset) ⇒ ConversationInstance
Update the ConversationInstance
486 487 488 489 490 491 492 493 494 495 496 497 498 499 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 486 def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset, timers_inactive: :unset, timers_closed: :unset, unique_name: :unset, x_twilio_webhook_enabled: :unset) context.update( friendly_name: friendly_name, date_created: date_created, date_updated: date_updated, attributes: attributes, messaging_service_sid: messaging_service_sid, state: state, timers_inactive: timers_inactive, timers_closed: timers_closed, unique_name: unique_name, x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) end |
#url ⇒ String
Returns An absolute URL for this conversation.
451 452 453 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 451 def url @properties['url'] end |
#webhooks ⇒ webhooks
Access the webhooks
534 535 536 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 534 def webhooks context.webhooks end |