Class: Twilio::REST::Conversations::V1::ServiceContext::ConversationInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Conversations::V1::ServiceContext::ConversationInstance
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/service/conversation.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this conversation.
-
#attributes ⇒ String
An optional string metadata field you can use to store any data you wish.
- #bindings ⇒ Hash
-
#chat_service_sid ⇒ String
The unique ID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) 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, limited to 256 characters.
-
#initialize(version, payload, chat_service_sid: nil, sid: nil) ⇒ ConversationInstance
constructor
Initialize the ConversationInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#links ⇒ Hash
Contains absolute URLs to access the [participants](www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation.
-
#messages ⇒ messages
Access the messages.
-
#messaging_service_sid ⇒ String
The unique ID of the [Messaging Service](www.twilio.com/docs/sms/services/api) this conversation belongs to.
-
#participants ⇒ participants
Access the participants.
-
#sid ⇒ String
A 34 character string that uniquely identifies this resource.
- #state ⇒ State
-
#timers ⇒ Hash
Timer date values representing state update 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 API resource URL for this conversation.
-
#webhooks ⇒ webhooks
Access the webhooks.
Constructor Details
#initialize(version, payload, chat_service_sid: nil, sid: nil) ⇒ ConversationInstance
Initialize the ConversationInstance
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 401 def initialize(version, payload , chat_service_sid: nil, 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'], 'bindings' => payload['bindings'], } # Context @instance_context = nil @params = { 'chat_service_sid' => chat_service_sid || @properties['chat_service_sid'] ,'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The unique ID of the [Account](www.twilio.com/docs/iam/api/account) responsible for this conversation.
440 441 442 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 440 def account_sid @properties['account_sid'] end |
#attributes ⇒ String
Returns 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.
476 477 478 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 476 def attributes @properties['attributes'] end |
#bindings ⇒ Hash
518 519 520 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 518 def bindings @properties['bindings'] end |
#chat_service_sid ⇒ String
Returns The unique ID of the [Conversation Service](www.twilio.com/docs/conversations/api/service-resource) this conversation belongs to.
446 447 448 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 446 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
431 432 433 434 435 436 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 431 def context unless @instance_context @instance_context = ConversationContext.new(@version , @params['chat_service_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date that this resource was created.
488 489 490 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 488 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date that this resource was last updated.
494 495 496 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 494 def date_updated @properties['date_updated'] end |
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the ConversationInstance
526 527 528 529 530 531 532 533 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 526 def delete( x_twilio_webhook_enabled: :unset ) context.delete( x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) end |
#fetch ⇒ ConversationInstance
Fetch the ConversationInstance
538 539 540 541 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 538 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The human-readable name of this conversation, limited to 256 characters. Optional.
464 465 466 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 464 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
613 614 615 616 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 613 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Conversations.V1.ConversationInstance #{values}>" end |
#links ⇒ Hash
Returns Contains absolute URLs to access the [participants](www.twilio.com/docs/conversations/api/conversation-participant-resource), [messages](www.twilio.com/docs/conversations/api/conversation-message-resource) and [webhooks](www.twilio.com/docs/conversations/api/conversation-scoped-webhook-resource) of this conversation.
512 513 514 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 512 def links @properties['links'] end |
#messages ⇒ messages
Access the messages
593 594 595 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 593 def context. end |
#messaging_service_sid ⇒ String
Returns The unique ID of the [Messaging Service](www.twilio.com/docs/sms/services/api) this conversation belongs to.
452 453 454 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 452 def messaging_service_sid @properties['messaging_service_sid'] end |
#participants ⇒ participants
Access the participants
586 587 588 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 586 def participants context.participants end |
#sid ⇒ String
Returns A 34 character string that uniquely identifies this resource.
458 459 460 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 458 def sid @properties['sid'] end |
#state ⇒ State
482 483 484 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 482 def state @properties['state'] end |
#timers ⇒ Hash
Returns Timer date values representing state update for this conversation.
500 501 502 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 500 def timers @properties['timers'] end |
#to_s ⇒ Object
Provide a user friendly representation
606 607 608 609 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 606 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. It can be used to address the resource in place of the resource’s ‘sid` in the URL.
470 471 472 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 470 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
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 556 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 API resource URL for this conversation.
506 507 508 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 506 def url @properties['url'] end |
#webhooks ⇒ webhooks
Access the webhooks
600 601 602 |
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation.rb', line 600 def webhooks context.webhooks end |