Class: Twilio::REST::Trunking::V1::TrunkInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/trunking/v1/trunk.rb

Instance Method Summary collapse

Constructor Details

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

Initialize the TrunkInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The unique string that we created to identify the Trunk resource to fetch.


379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 379

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

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'domain_name' => payload['domain_name'],
      'disaster_recovery_method' => payload['disaster_recovery_method'],
      'disaster_recovery_url' => payload['disaster_recovery_url'],
      'friendly_name' => payload['friendly_name'],
      'secure' => payload['secure'],
      'recording' => payload['recording'],
      'transfer_mode' => payload['transfer_mode'],
      'cnam_lookup_enabled' => payload['cnam_lookup_enabled'],
      'auth_type' => payload['auth_type'],
      'auth_type_set' => payload['auth_type_set'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'sid' => payload['sid'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


420
421
422
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 420

def 
  @properties['account_sid']
end

#auth_typeString

Returns The types of authentication mapped to the domain.

Returns:

  • (String)

    The types of authentication mapped to the domain


474
475
476
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 474

def auth_type
  @properties['auth_type']
end

#auth_type_setArray[String]

Returns Reserved.

Returns:

  • (Array[String])

    Reserved


480
481
482
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 480

def auth_type_set
  @properties['auth_type_set']
end

#cnam_lookup_enabledBoolean

Returns Whether Caller ID Name (CNAM) lookup is enabled for the trunk.

Returns:

  • (Boolean)

    Whether Caller ID Name (CNAM) lookup is enabled for the trunk


468
469
470
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 468

def cnam_lookup_enabled
  @properties['cnam_lookup_enabled']
end

#contextTrunkContext

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

Returns:


411
412
413
414
415
416
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 411

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

#credentials_listscredentials_lists

Access the credentials_lists

Returns:


582
583
584
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 582

def credentials_lists
  context.credentials_lists
end

#date_createdTime

Returns The RFC 2822 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was created


486
487
488
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 486

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was last updated


492
493
494
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 492

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the TrunkInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


524
525
526
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 524

def delete
  context.delete
end

#disaster_recovery_methodString

Returns The HTTP method we use to call the disaster_recovery_url.

Returns:

  • (String)

    The HTTP method we use to call the disaster_recovery_url


432
433
434
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 432

def disaster_recovery_method
  @properties['disaster_recovery_method']
end

#disaster_recovery_urlString

Returns The HTTP URL that we call if an error occurs while sending SIP traffic towards your configured Origination URL.

Returns:

  • (String)

    The HTTP URL that we call if an error occurs while sending SIP traffic towards your configured Origination URL


438
439
440
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 438

def disaster_recovery_url
  @properties['disaster_recovery_url']
end

#domain_nameString

Returns The unique address you reserve on Twilio to which you route your SIP traffic.

Returns:

  • (String)

    The unique address you reserve on Twilio to which you route your SIP traffic


426
427
428
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 426

def domain_name
  @properties['domain_name']
end

#fetchTrunkInstance

Fetch the TrunkInstance

Returns:


517
518
519
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 517

def fetch
  context.fetch
end

#friendly_nameString

Returns The string that you assigned to describe the resource.

Returns:

  • (String)

    The string that you assigned to describe the resource


444
445
446
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 444

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation


616
617
618
619
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 616

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

#ip_access_control_listsip_access_control_lists

Access the ip_access_control_lists

Returns:


589
590
591
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 589

def ip_access_control_lists
  context.ip_access_control_lists
end

Returns The URLs of related resources.

Returns:

  • (String)

    The URLs of related resources


510
511
512
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 510

def links
  @properties['links']
end

#origination_urlsorigination_urls

Access the origination_urls

Returns:


575
576
577
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 575

def origination_urls
  context.origination_urls
end

#phone_numbersphone_numbers

Access the phone_numbers

Returns:


596
597
598
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 596

def phone_numbers
  context.phone_numbers
end

#recordingHash

Returns The recording settings for the trunk.

Returns:

  • (Hash)

    The recording settings for the trunk


456
457
458
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 456

def recording
  @properties['recording']
end

#recordingsrecordings

Access the recordings

Returns:


603
604
605
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 603

def recordings
  context.recordings
end

#secureBoolean

Returns Whether Secure Trunking is enabled for the trunk.

Returns:

  • (Boolean)

    Whether Secure Trunking is enabled for the trunk


450
451
452
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 450

def secure
  @properties['secure']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


498
499
500
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 498

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


609
610
611
612
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 609

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

#transfer_modetrunk.TransferSetting

Returns The call transfer settings for the trunk.

Returns:

  • (trunk.TransferSetting)

    The call transfer settings for the trunk


462
463
464
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 462

def transfer_mode
  @properties['transfer_mode']
end

#update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, transfer_mode: :unset, secure: :unset, cnam_lookup_enabled: :unset) ⇒ TrunkInstance

Update the TrunkInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the resource. It can be up to 64 characters long.

  • domain_name (String) (defaults to: :unset)

    The unique address you reserve on Twilio to which you route your SIP traffic. Domain names can contain letters, digits, and `-` and must end with `pstn.twilio.com`. See Termination Settings for more information.

  • disaster_recovery_url (String) (defaults to: :unset)

    The URL we should call using the `disaster_recovery_method` if an error occurs while sending SIP traffic towards the configured Origination URL. We retrieve TwiML from the URL and execute the instructions like any other normal TwiML call. See Disaster Recovery for more information.

  • disaster_recovery_method (String) (defaults to: :unset)

    The HTTP method we should use to call the `disaster_recovery_url`. Can be: `GET` or `POST`.

  • transfer_mode (trunk.TransferSetting) (defaults to: :unset)

    The call transfer settings for the trunk. Can be: `enable-all`, `sip-only` and `disable-all`. See Transfer for more information.

  • secure (Boolean) (defaults to: :unset)

    Whether Secure Trunking is enabled for the trunk. If enabled, all calls going through the trunk will be secure using SRTP for media and TLS for signaling. If disabled, then RTP will be used for media. See Secure Trunking for more information.

  • cnam_lookup_enabled (Boolean) (defaults to: :unset)

    Whether Caller ID Name (CNAM) lookup should be enabled for the trunk. If enabled, all inbound calls to the SIP Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See CNAM Lookups for more information.

Returns:


560
561
562
563
564
565
566
567
568
569
570
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 560

def update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, transfer_mode: :unset, secure: :unset, cnam_lookup_enabled: :unset)
  context.update(
      friendly_name: friendly_name,
      domain_name: domain_name,
      disaster_recovery_url: disaster_recovery_url,
      disaster_recovery_method: disaster_recovery_method,
      transfer_mode: transfer_mode,
      secure: secure,
      cnam_lookup_enabled: cnam_lookup_enabled,
  )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource


504
505
506
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 504

def url
  @properties['url']
end