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

Public Class Methods

new(version, payload, chat_service_sid: nil, 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] chat_service_sid The unique ID of the {Conversation

Service}[https://www.twilio.com/docs/conversations/api/service-resource] this
conversation belongs to.

@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/service/conversation.rb
379 def initialize(version, payload, chat_service_sid: nil, sid: nil)
380   super(version)
381 
382   # Marshaled Properties
383   @properties = {
384       'account_sid' => payload['account_sid'],
385       'chat_service_sid' => payload['chat_service_sid'],
386       'messaging_service_sid' => payload['messaging_service_sid'],
387       'sid' => payload['sid'],
388       'friendly_name' => payload['friendly_name'],
389       'unique_name' => payload['unique_name'],
390       'attributes' => payload['attributes'],
391       'state' => payload['state'],
392       'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
393       'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
394       'timers' => payload['timers'],
395       'url' => payload['url'],
396       'links' => payload['links'],
397       'bindings' => payload['bindings'],
398   }
399 
400   # Context
401   @instance_context = nil
402   @params = {'chat_service_sid' => chat_service_sid, 'sid' => sid || @properties['sid'], }
403 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/service/conversation.rb
418 def account_sid
419   @properties['account_sid']
420 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/service/conversation.rb
454 def attributes
455   @properties['attributes']
456 end
bindings() click to toggle source

@return [Hash] The bindings

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
496 def bindings
497   @properties['bindings']
498 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/service/conversation.rb
424 def chat_service_sid
425   @properties['chat_service_sid']
426 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/service/conversation.rb
409 def context
410   unless @instance_context
411     @instance_context = ConversationContext.new(@version, @params['chat_service_sid'], @params['sid'], )
412   end
413   @instance_context
414 end
date_created() click to toggle source

@return [Time] The date that this resource was created.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
466 def date_created
467   @properties['date_created']
468 end
date_updated() click to toggle source

@return [Time] The date that this resource was last updated.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
472 def date_updated
473   @properties['date_updated']
474 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/service/conversation.rb
545 def delete(x_twilio_webhook_enabled: :unset)
546   context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, )
547 end
fetch() click to toggle source

Fetch the ConversationInstance @return [ConversationInstance] Fetched ConversationInstance

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
552 def fetch
553   context.fetch
554 end
friendly_name() click to toggle source

@return [String] The human-readable name of this conversation.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
442 def friendly_name
443   @properties['friendly_name']
444 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
586 def inspect
587   values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
588   "<Twilio.Conversations.V1.ConversationInstance #{values}>"
589 end
messages() click to toggle source

Access the messages @return [messages] messages

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
566 def messages
567   context.messages
568 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/service/conversation.rb
430 def messaging_service_sid
431   @properties['messaging_service_sid']
432 end
participants() click to toggle source

Access the participants @return [participants] participants

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
559 def participants
560   context.participants
561 end
sid() click to toggle source

@return [String] A 34 character string that uniquely identifies this resource.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
436 def sid
437   @properties['sid']
438 end
state() click to toggle source

@return [conversation.State] Current state of this conversation.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
460 def state
461   @properties['state']
462 end
timers() click to toggle source

@return [Hash] Timer date values for this conversation.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
478 def timers
479   @properties['timers']
480 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
579 def to_s
580   values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
581   "<Twilio.Conversations.V1.ConversationInstance #{values}>"
582 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/service/conversation.rb
448 def unique_name
449   @properties['unique_name']
450 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/service/conversation.rb
525 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)
526   context.update(
527       friendly_name: friendly_name,
528       date_created: date_created,
529       date_updated: date_updated,
530       attributes: attributes,
531       messaging_service_sid: messaging_service_sid,
532       state: state,
533       timers_inactive: timers_inactive,
534       timers_closed: timers_closed,
535       unique_name: unique_name,
536       x_twilio_webhook_enabled: x_twilio_webhook_enabled,
537   )
538 end
url() click to toggle source

@return [String] An absolute URL for this conversation.

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
484 def url
485   @properties['url']
486 end
webhooks() click to toggle source

Access the webhooks @return [webhooks] webhooks

    # File lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
573 def webhooks
574   context.webhooks
575 end