Class: Twilio::REST::Conversations::V1::AddressConfigurationInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/address_configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ AddressConfigurationInstance

Initialize the AddressConfigurationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The SID of the Address Configuration resource. This value can be either the ‘sid` or the `address` of the configuration



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 282

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'type' => payload['type'],
      'address' => payload['address'],
      'friendly_name' => payload['friendly_name'],
      'auto_creation' => payload['auto_creation'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The unique ID of the Account the address belongs to.

Returns:

  • (String)

    The unique ID of the Account the address belongs to.



322
323
324
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 322

def 
  @properties['account_sid']
end

#addressString

Returns The unique address to be configured.

Returns:

  • (String)

    The unique address to be configured.



334
335
336
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 334

def address
  @properties['address']
end

#auto_creationHash

Returns Auto Creation configuration for the address.

Returns:

  • (Hash)

    Auto Creation configuration for the address.



346
347
348
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 346

def auto_creation
  @properties['auto_creation']
end

#contextAddressConfigurationContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



307
308
309
310
311
312
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 307

def context
  unless @instance_context
    @instance_context = AddressConfigurationContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The date that this resource was created.

Returns:

  • (Time)

    The date that this resource was created.



352
353
354
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 352

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated.

Returns:

  • (Time)

    The date that this resource was last updated.



358
359
360
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 358

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the AddressConfigurationInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



414
415
416
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 414

def delete
  context.delete
end

#fetchAddressConfigurationInstance

Fetch the AddressConfigurationInstance

Returns:



371
372
373
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 371

def fetch
  context.fetch
end

#friendly_nameString

Returns The human-readable name of this configuration.

Returns:

  • (String)

    The human-readable name of this configuration.



340
341
342
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 340

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



427
428
429
430
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 427

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Conversations.V1.AddressConfigurationInstance #{values}>"
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



316
317
318
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 316

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



420
421
422
423
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 420

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Conversations.V1.AddressConfigurationInstance #{values}>"
end

#typeString

Returns Type of Address, value can be ‘whatsapp` or `sms`.

Returns:

  • (String)

    Type of Address, value can be ‘whatsapp` or `sms`.



328
329
330
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 328

def type
  @properties['type']
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`, `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.

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



397
398
399
400
401
402
403
404
405
406
407
408
409
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 397

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)
  context.update(
      friendly_name: friendly_name,
      auto_creation_enabled: auto_creation_enabled,
      auto_creation_type: auto_creation_type,
      auto_creation_conversation_service_sid: auto_creation_conversation_service_sid,
      auto_creation_webhook_url: auto_creation_webhook_url,
      auto_creation_webhook_method: auto_creation_webhook_method,
      auto_creation_webhook_filters: auto_creation_webhook_filters,
      auto_creation_studio_flow_sid: auto_creation_studio_flow_sid,
      auto_creation_studio_retry_count: auto_creation_studio_retry_count,
  )
end

#urlString

Returns An absolute URL for this address configuration.

Returns:

  • (String)

    An absolute URL for this address configuration.



364
365
366
# File 'lib/twilio-ruby/rest/conversations/v1/address_configuration.rb', line 364

def url
  @properties['url']
end