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



190
191
192
193
194
195
196
197
198
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 190

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



202
203
204
205
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 202

def delete

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

#fetchAddressConfigurationInstance

Fetch the AddressConfigurationInstance

Returns:



210
211
212
213
214
215
216
217
218
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 210

def fetch

    payload = @version.fetch('GET', @uri)
    AddressConfigurationInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



267
268
269
270
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 267

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:



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 232

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