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



193
194
195
196
197
198
199
200
201
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 193

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



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

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:



215
216
217
218
219
220
221
222
223
224
225
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 215

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



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



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 239

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