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



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

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



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

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchAddressConfigurationInstance

Fetch the AddressConfigurationInstance

Returns:



224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 224

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

#inspectObject

Provide a detailed, user friendly representation



300
301
302
303
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 300

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

#to_sObject

Provide a user friendly representation



293
294
295
296
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 293

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:



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 252

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