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


206
207
208
209
210
211
212
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 206

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


270
271
272
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 270

def delete
   @version.delete('DELETE', @uri)
end

#fetchAddressConfigurationInstance

Fetch the AddressConfigurationInstance

Returns:


217
218
219
220
221
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 217

def fetch
  payload = @version.fetch('GET', @uri)

  AddressConfigurationInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


283
284
285
286
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 283

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

#to_sObject

Provide a user friendly representation


276
277
278
279
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 276

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 (address_configuration.AutoCreationType) (defaults to: :unset)

    Type of Auto Creation. Value can be one of `webhook`, `studio` or `default`.

  • 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 (address_configuration.Method) (defaults to: :unset)

    For type `webhook`, the HTTP method to be used when sending a webhook request.

  • 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:


249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 249

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,
  })

  payload = @version.update('POST', @uri, data: data)

  AddressConfigurationInstance.new(@version, payload, sid: @solution[:sid], )
end