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



289
290
291
292
293
294
295
296
297
298
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 289

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



302
303
304
305
306
307
308
309
310
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 302

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



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 315

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:



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 334

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:



353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 353

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



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

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

#to_sObject

Provide a user friendly representation



484
485
486
487
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 484

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:



387
388
389
390
391
392
393
394
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
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 387

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:



437
438
439
440
441
442
443
444
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
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 437

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