Class: Twilio::REST::Conversations::V1::AddressConfigurationContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/address_configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ AddressConfigurationContext

Initialize the AddressConfigurationContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Address Configuration resource. This value can be either the ‘sid` or the `address` of the configuration



297
298
299
300
301
302
303
304
305
306
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 297

def initialize(version, sid)
    super(version)
    

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/Configuration/Addresses/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the AddressConfigurationInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



310
311
312
313
314
315
316
317
318
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 310

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the AddressConfigurationInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 323

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      addressConfiguration_instance = AddressConfigurationInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      AddressConfigurationInstanceMetadata.new(@version, addressConfiguration_instance, response.headers, response.status_code)
end

#fetchAddressConfigurationInstance

Fetch the AddressConfigurationInstance

Returns:



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 342

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    AddressConfigurationInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#fetch_with_metadataAddressConfigurationInstance

Fetch the AddressConfigurationInstanceMetadata

Returns:



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 361

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    address_configuration_instance = AddressConfigurationInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    AddressConfigurationInstanceMetadata.new(
        @version,
        address_configuration_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



499
500
501
502
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 499

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Conversations.V1.AddressConfigurationContext #{context}>"
end

#to_sObject

Provide a user friendly representation



492
493
494
495
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 492

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Conversations.V1.AddressConfigurationContext #{context}>"
end

#update(friendly_name: :unset, auto_creation_enabled: :unset, auto_creation_type: :unset, auto_creation_conversation_service_sid: :unset, auto_creation_webhook_url: :unset, auto_creation_webhook_method: :unset, auto_creation_webhook_filters: :unset, auto_creation_studio_flow_sid: :unset, auto_creation_studio_retry_count: :unset) ⇒ AddressConfigurationInstance

Update the AddressConfigurationInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    The human-readable name of this configuration, limited to 256 characters. Optional.

  • auto_creation_enabled (Boolean) (defaults to: :unset)

    Enable/Disable auto-creating conversations for messages to this address

  • auto_creation_type (AutoCreationType) (defaults to: :unset)
  • auto_creation_conversation_service_sid (String) (defaults to: :unset)

    Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service.

  • auto_creation_webhook_url (String) (defaults to: :unset)

    For type ‘webhook`, the url for the webhook request.

  • auto_creation_webhook_method (Method) (defaults to: :unset)
  • auto_creation_webhook_filters (Array[String]) (defaults to: :unset)

    The list of events, firing webhook event for this Conversation. Values can be any of the following: ‘onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated`

  • auto_creation_studio_flow_sid (String) (defaults to: :unset)

    For type ‘studio`, the studio flow SID where the webhook should be sent to.

  • auto_creation_studio_retry_count (String) (defaults to: :unset)

    For type ‘studio`, number of times to retry the webhook request

Returns:



395
396
397
398
399
400
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
426
427
428
429
430
431
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 395

def update(
  friendly_name: :unset, 
  auto_creation_enabled: :unset, 
  auto_creation_type: :unset, 
  auto_creation_conversation_service_sid: :unset, 
  auto_creation_webhook_url: :unset, 
  auto_creation_webhook_method: :unset, 
  auto_creation_webhook_filters: :unset, 
  auto_creation_studio_flow_sid: :unset, 
  auto_creation_studio_retry_count: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'AutoCreation.Enabled' => auto_creation_enabled,
        'AutoCreation.Type' => auto_creation_type,
        'AutoCreation.ConversationServiceSid' => auto_creation_conversation_service_sid,
        'AutoCreation.WebhookUrl' => auto_creation_webhook_url,
        'AutoCreation.WebhookMethod' => auto_creation_webhook_method,
        'AutoCreation.WebhookFilters' => Twilio.serialize_list(auto_creation_webhook_filters) { |e| e },
        'AutoCreation.StudioFlowSid' => auto_creation_studio_flow_sid,
        'AutoCreation.StudioRetryCount' => auto_creation_studio_retry_count,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    AddressConfigurationInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#update_with_metadata(friendly_name: :unset, auto_creation_enabled: :unset, auto_creation_type: :unset, auto_creation_conversation_service_sid: :unset, auto_creation_webhook_url: :unset, auto_creation_webhook_method: :unset, auto_creation_webhook_filters: :unset, auto_creation_studio_flow_sid: :unset, auto_creation_studio_retry_count: :unset) ⇒ AddressConfigurationInstance

Update the AddressConfigurationInstanceMetadata

Parameters:

  • friendly_name (String) (defaults to: :unset)

    The human-readable name of this configuration, limited to 256 characters. Optional.

  • auto_creation_enabled (Boolean) (defaults to: :unset)

    Enable/Disable auto-creating conversations for messages to this address

  • auto_creation_type (AutoCreationType) (defaults to: :unset)
  • auto_creation_conversation_service_sid (String) (defaults to: :unset)

    Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service.

  • auto_creation_webhook_url (String) (defaults to: :unset)

    For type ‘webhook`, the url for the webhook request.

  • auto_creation_webhook_method (Method) (defaults to: :unset)
  • auto_creation_webhook_filters (Array[String]) (defaults to: :unset)

    The list of events, firing webhook event for this Conversation. Values can be any of the following: ‘onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated`

  • auto_creation_studio_flow_sid (String) (defaults to: :unset)

    For type ‘studio`, the studio flow SID where the webhook should be sent to.

  • auto_creation_studio_retry_count (String) (defaults to: :unset)

    For type ‘studio`, number of times to retry the webhook request

Returns:



445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 445

def (
  friendly_name: :unset, 
  auto_creation_enabled: :unset, 
  auto_creation_type: :unset, 
  auto_creation_conversation_service_sid: :unset, 
  auto_creation_webhook_url: :unset, 
  auto_creation_webhook_method: :unset, 
  auto_creation_webhook_filters: :unset, 
  auto_creation_studio_flow_sid: :unset, 
  auto_creation_studio_retry_count: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'AutoCreation.Enabled' => auto_creation_enabled,
        'AutoCreation.Type' => auto_creation_type,
        'AutoCreation.ConversationServiceSid' => auto_creation_conversation_service_sid,
        'AutoCreation.WebhookUrl' => auto_creation_webhook_url,
        'AutoCreation.WebhookMethod' => auto_creation_webhook_method,
        'AutoCreation.WebhookFilters' => Twilio.serialize_list(auto_creation_webhook_filters) { |e| e },
        'AutoCreation.StudioFlowSid' => auto_creation_studio_flow_sid,
        'AutoCreation.StudioRetryCount' => auto_creation_studio_retry_count,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    address_configuration_instance = AddressConfigurationInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    AddressConfigurationInstanceMetadata.new(
        @version,
        address_configuration_instance,
        response.headers,
        response.status_code
    )
end