class Twilio::REST::Conversations::V1::ConversationInstance
Public Class Methods
Initialize the ConversationInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] sid A 34 character string that uniquely identifies this
resource. Can also be the `unique_name` of the Conversation.
@return [ConversationInstance] ConversationInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 347 def initialize(version, payload, sid: nil) 348 super(version) 349 350 # Marshaled Properties 351 @properties = { 352 'account_sid' => payload['account_sid'], 353 'chat_service_sid' => payload['chat_service_sid'], 354 'messaging_service_sid' => payload['messaging_service_sid'], 355 'sid' => payload['sid'], 356 'friendly_name' => payload['friendly_name'], 357 'unique_name' => payload['unique_name'], 358 'attributes' => payload['attributes'], 359 'state' => payload['state'], 360 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 361 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 362 'timers' => payload['timers'], 363 'url' => payload['url'], 364 'links' => payload['links'], 365 'bindings' => payload['bindings'], 366 } 367 368 # Context 369 @instance_context = nil 370 @params = {'sid' => sid || @properties['sid'], } 371 end
Public Instance Methods
@return [String] The unique ID of the Account responsible for this conversation.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 386 def account_sid 387 @properties['account_sid'] 388 end
@return [String] An optional string metadata field you can use to store any data you wish.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 422 def attributes 423 @properties['attributes'] 424 end
@return [Hash] The bindings
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 464 def bindings 465 @properties['bindings'] 466 end
@return [String] The unique ID of the Conversation Service this conversation belongs to.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 392 def chat_service_sid 393 @properties['chat_service_sid'] 394 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [ConversationContext] ConversationContext
for this ConversationInstance
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 377 def context 378 unless @instance_context 379 @instance_context = ConversationContext.new(@version, @params['sid'], ) 380 end 381 @instance_context 382 end
@return [Time] The date that this resource was created.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 434 def date_created 435 @properties['date_created'] 436 end
@return [Time] The date that this resource was last updated.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 440 def date_updated 441 @properties['date_updated'] 442 end
Delete the ConversationInstance
@param [conversation.WebhookEnabledType] x_twilio_webhook_enabled The
X-Twilio-Webhook-Enabled HTTP request header
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 513 def delete(x_twilio_webhook_enabled: :unset) 514 context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) 515 end
Fetch the ConversationInstance
@return [ConversationInstance] Fetched ConversationInstance
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 520 def fetch 521 context.fetch 522 end
@return [String] The human-readable name of this conversation.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 410 def friendly_name 411 @properties['friendly_name'] 412 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 554 def inspect 555 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 556 "<Twilio.Conversations.V1.ConversationInstance #{values}>" 557 end
@return [String] Absolute URLs to access the participants, messages and webhooks of this conversation.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 458 def links 459 @properties['links'] 460 end
Access the messages @return [messages] messages
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 534 def messages 535 context.messages 536 end
@return [String] The unique ID of the Messaging
Service this conversation belongs to.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 398 def messaging_service_sid 399 @properties['messaging_service_sid'] 400 end
Access the participants @return [participants] participants
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 527 def participants 528 context.participants 529 end
@return [String] A 34 character string that uniquely identifies this resource.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 404 def sid 405 @properties['sid'] 406 end
@return [conversation.State] Current state of this conversation.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 428 def state 429 @properties['state'] 430 end
@return [Hash] Timer date values for this conversation.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 446 def timers 447 @properties['timers'] 448 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 547 def to_s 548 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 549 "<Twilio.Conversations.V1.ConversationInstance #{values}>" 550 end
@return [String] An application-defined string that uniquely identifies the resource
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 416 def unique_name 417 @properties['unique_name'] 418 end
Update the ConversationInstance
@param [String] friendly_name
The human-readable name of this conversation,
limited to 256 characters. Optional.
@param [Time] date_created
The date that this resource was created. @param [Time] date_updated
The date that this resource was last updated. @param [String] attributes An optional string metadata field you can use to
store any data you wish. The string value must contain structurally valid JSON if specified. **Note** that if the attributes are not set "{}" will be returned.
@param [String] messaging_service_sid
The unique ID of the {Messaging
Service}[https://www.twilio.com/docs/sms/services/api] this conversation belongs to.
@param [conversation.State] state Current state of this conversation. Can be
either `active`, `inactive` or `closed` and defaults to `active`
@param [String] timers_inactive ISO8601 duration when conversation will be
switched to `inactive` state. Minimum value for this timer is 1 minute.
@param [String] timers_closed ISO8601 duration when conversation will be
switched to `closed` state. Minimum value for this timer is 10 minutes.
@param [String] unique_name
An application-defined string that uniquely
identifies the resource. It can be used to address the resource in place of the resource's `sid` in the URL.
@param [conversation.WebhookEnabledType] x_twilio_webhook_enabled The
X-Twilio-Webhook-Enabled HTTP request header
@return [ConversationInstance] Updated ConversationInstance
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 493 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) 494 context.update( 495 friendly_name: friendly_name, 496 date_created: date_created, 497 date_updated: date_updated, 498 attributes: attributes, 499 messaging_service_sid: messaging_service_sid, 500 state: state, 501 timers_inactive: timers_inactive, 502 timers_closed: timers_closed, 503 unique_name: unique_name, 504 x_twilio_webhook_enabled: x_twilio_webhook_enabled, 505 ) 506 end
@return [String] An absolute URL for this conversation.
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 452 def url 453 @properties['url'] 454 end
Access the webhooks @return [webhooks] webhooks
# File lib/twilio-ruby/rest/conversations/v1/conversation.rb 541 def webhooks 542 context.webhooks 543 end