class Twilio::REST::Conversations::V1::ConversationInstance

Public Class Methods

new(version, payload, sid: nil) click to toggle source

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

Calls superclass method 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

account_sid() click to toggle source

@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
attributes() click to toggle source

@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
bindings() click to toggle source

@return [Hash] The bindings

    # File lib/twilio-ruby/rest/conversations/v1/conversation.rb
464 def bindings
465   @properties['bindings']
466 end
chat_service_sid() click to toggle source

@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
context() click to toggle source

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
date_created() click to toggle source

@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
date_updated() click to toggle source

@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(x_twilio_webhook_enabled: :unset) click to toggle source

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() click to toggle source

Fetch the ConversationInstance @return [ConversationInstance] Fetched ConversationInstance

    # File lib/twilio-ruby/rest/conversations/v1/conversation.rb
520 def fetch
521   context.fetch
522 end
friendly_name() click to toggle source

@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
inspect() click to toggle source

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
messages() click to toggle source

Access the messages @return [messages] messages

    # File lib/twilio-ruby/rest/conversations/v1/conversation.rb
534 def messages
535   context.messages
536 end
messaging_service_sid() click to toggle source

@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
participants() click to toggle source

Access the participants @return [participants] participants

    # File lib/twilio-ruby/rest/conversations/v1/conversation.rb
527 def participants
528   context.participants
529 end
sid() click to toggle source

@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
state() click to toggle source

@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
timers() click to toggle source

@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
to_s() click to toggle source

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
unique_name() click to toggle source

@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(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) click to toggle source

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
url() click to toggle source

@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
webhooks() click to toggle source

Access the webhooks @return [webhooks] webhooks

    # File lib/twilio-ruby/rest/conversations/v1/conversation.rb
541 def webhooks
542   context.webhooks
543 end