Class: Twilio::REST::Conversations::V1::ServiceContext::ConversationContext::WebhookInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil) ⇒ WebhookInstance

Initialize the WebhookInstance

Parameters:



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 303

def initialize(version, payload, chat_service_sid: nil, conversation_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'chat_service_sid' => payload['chat_service_sid'],
      'conversation_sid' => payload['conversation_sid'],
      'target' => payload['target'],
      'url' => payload['url'],
      'configuration' => payload['configuration'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
  }

  # Context
  @instance_context = nil
  @params = {
      'chat_service_sid' => chat_service_sid,
      'conversation_sid' => conversation_sid,
      'sid' => sid || @properties['sid'],
  }
end

Instance Method Details

#account_sidString

Returns The unique id of the Account responsible for this conversation.

Returns:

  • The unique id of the Account responsible for this conversation.



352
353
354
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 352

def 
  @properties['account_sid']
end

#chat_service_sidString

Returns The SID of the Chat Service that the resource is associated with.

Returns:

  • The SID of the Chat Service that the resource is associated with.



358
359
360
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 358

def chat_service_sid
  @properties['chat_service_sid']
end

#configurationHash

Returns The configuration of this webhook.

Returns:

  • The configuration of this webhook.



382
383
384
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 382

def configuration
  @properties['configuration']
end

#contextWebhookContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:

  • WebhookContext for this WebhookInstance



332
333
334
335
336
337
338
339
340
341
342
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 332

def context
  unless @instance_context
    @instance_context = WebhookContext.new(
        @version,
        @params['chat_service_sid'],
        @params['conversation_sid'],
        @params['sid'],
    )
  end
  @instance_context
end

#conversation_sidString

Returns The unique id of the Conversation for this webhook.

Returns:

  • The unique id of the Conversation for this webhook.



364
365
366
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 364

def conversation_sid
  @properties['conversation_sid']
end

#date_createdTime

Returns The date that this resource was created.

Returns:

  • The date that this resource was created.



388
389
390
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 388

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated.

Returns:

  • The date that this resource was last updated.



394
395
396
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 394

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the WebhookInstance

Returns:

  • true if delete succeeds, false otherwise



424
425
426
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 424

def delete
  context.delete
end

#fetchWebhookInstance

Fetch the WebhookInstance

Returns:

  • Fetched WebhookInstance



431
432
433
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 431

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



444
445
446
447
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 444

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Conversations.V1.WebhookInstance #{values}>"
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • A 34 character string that uniquely identifies this resource.



346
347
348
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 346

def sid
  @properties['sid']
end

#targetString

Returns The target of this webhook.

Returns:

  • The target of this webhook.



370
371
372
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 370

def target
  @properties['target']
end

#to_sObject

Provide a user friendly representation



437
438
439
440
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 437

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Conversations.V1.WebhookInstance #{values}>"
end

#update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset) ⇒ WebhookInstance

Update the WebhookInstance

Parameters:

  • (defaults to: :unset)

    The absolute url the webhook request should be sent to.

  • (defaults to: :unset)

    The HTTP method to be used when sending a webhook request.

  • (defaults to: :unset)

    The list of events, firing webhook event for this Conversation.

  • (defaults to: :unset)

    The list of keywords, firing webhook event for this Conversation.

  • (defaults to: :unset)

    The studio flow sid, where the webhook should be sent to.

Returns:

  • Updated WebhookInstance



411
412
413
414
415
416
417
418
419
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 411

def update(configuration_url: :unset, configuration_method: :unset, configuration_filters: :unset, configuration_triggers: :unset, configuration_flow_sid: :unset)
  context.update(
      configuration_url: configuration_url,
      configuration_method: configuration_method,
      configuration_filters: configuration_filters,
      configuration_triggers: configuration_triggers,
      configuration_flow_sid: configuration_flow_sid,
  )
end

#urlString

Returns An absolute URL for this webhook.

Returns:

  • An absolute URL for this webhook.



376
377
378
# File 'lib/twilio-ruby/rest/conversations/v1/service/conversation/webhook.rb', line 376

def url
  @properties['url']
end