Class: Twilio::REST::Conversations::V1::ConversationContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Conversations::V1::ConversationContext
- Defined in:
- lib/twilio-ruby/rest/conversations/v1/conversation.rb,
lib/twilio-ruby/rest/conversations/v1/conversation/message.rb,
lib/twilio-ruby/rest/conversations/v1/conversation/webhook.rb,
lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb,
lib/twilio-ruby/rest/conversations/v1/conversation/message/delivery_receipt.rb
Defined Under Namespace
Classes: MessageContext, MessageInstance, MessageList, MessagePage, ParticipantContext, ParticipantInstance, ParticipantList, ParticipantPage, WebhookContext, WebhookInstance, WebhookList, WebhookPage
Instance Method Summary collapse
-
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the ConversationInstance.
-
#fetch ⇒ ConversationInstance
Fetch the ConversationInstance.
-
#initialize(version, sid) ⇒ ConversationContext
constructor
Initialize the ConversationContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#messages(sid = :unset) ⇒ MessageList, MessageContext
Access the messages.
-
#participants(sid = :unset) ⇒ ParticipantList, ParticipantContext
Access the participants.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#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, bindings_email_address: :unset, bindings_email_name: :unset, x_twilio_webhook_enabled: :unset) ⇒ ConversationInstance
Update the ConversationInstance.
-
#webhooks(sid = :unset) ⇒ WebhookList, WebhookContext
Access the webhooks.
Constructor Details
#initialize(version, sid) ⇒ ConversationContext
Initialize the ConversationContext
202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 202 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Conversations/#{@solution[:sid]}" # Dependents @webhooks = nil @messages = nil @participants = nil end |
Instance Method Details
#delete(x_twilio_webhook_enabled: :unset) ⇒ Boolean
Delete the ConversationInstance
218 219 220 221 222 223 224 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 218 def delete( x_twilio_webhook_enabled: :unset ) headers = Twilio::Values.of({ 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ ConversationInstance
Fetch the ConversationInstance
229 230 231 232 233 234 235 236 237 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 229 def fetch payload = @version.fetch('GET', @uri) ConversationInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
359 360 361 362 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 359 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.ConversationContext #{context}>" end |
#messages(sid = :unset) ⇒ MessageList, MessageContext
Access the messages
315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 315 def (sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return MessageContext.new(@version, @solution[:sid],sid ) end unless @messages @messages = MessageList.new( @version, conversation_sid: @solution[:sid], ) end @messages end |
#participants(sid = :unset) ⇒ ParticipantList, ParticipantContext
Access the participants
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 334 def participants(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ParticipantContext.new(@version, @solution[:sid],sid ) end unless @participants @participants = ParticipantList.new( @version, conversation_sid: @solution[:sid], ) end @participants end |
#to_s ⇒ Object
Provide a user friendly representation
352 353 354 355 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 352 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Conversations.V1.ConversationContext #{context}>" 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, bindings_email_address: :unset, bindings_email_name: :unset, x_twilio_webhook_enabled: :unset) ⇒ ConversationInstance
Update the ConversationInstance
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 254 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, bindings_email_address: :unset, bindings_email_name: :unset, x_twilio_webhook_enabled: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'DateCreated' => Twilio.serialize_iso8601_datetime(date_created), 'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated), 'Attributes' => attributes, 'MessagingServiceSid' => messaging_service_sid, 'State' => state, 'Timers.Inactive' => timers_inactive, 'Timers.Closed' => timers_closed, 'UniqueName' => unique_name, 'Bindings.Email.Address' => bindings_email_address, 'Bindings.Email.Name' => bindings_email_name, }) headers = Twilio::Values.of({ 'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, }) payload = @version.update('POST', @uri, data: data, headers: headers) ConversationInstance.new( @version, payload, sid: @solution[:sid], ) end |
#webhooks(sid = :unset) ⇒ WebhookList, WebhookContext
Access the webhooks
296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/twilio-ruby/rest/conversations/v1/conversation.rb', line 296 def webhooks(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return WebhookContext.new(@version, @solution[:sid],sid ) end unless @webhooks @webhooks = WebhookList.new( @version, conversation_sid: @solution[:sid], ) end @webhooks end |