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.



406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 406

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'],
      '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_sid ⇒ String

Returns The SID of the Account that created the resource.

Returns:

  • (String) —

    The SID of the Account that created the resource



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

def 
  @properties['account_sid']
end

#auth_type ⇒ String

Returns The types of authentication mapped to the domain.

Returns:

  • (String) —

    The types of authentication mapped to the domain



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

def auth_type
  @properties['auth_type']
end

#auth_type_set ⇒ String

Returns Reserved.

Returns:

  • (String) —

    Reserved



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

def auth_type_set
  @properties['auth_type_set']
end

#cnam_lookup_enabled ⇒ Boolean

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



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

def cnam_lookup_enabled
  @properties['cnam_lookup_enabled']
end

#context ⇒ TrunkContext

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

Returns:



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

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

#credentials_lists ⇒ credentials_lists

Access the credentials_lists

Returns:



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

def credentials_lists
  context.credentials_lists
end

#date_created ⇒ Time

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



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

def date_created
  @properties['date_created']
end

#date_updated ⇒ Time

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



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

def date_updated
  @properties['date_updated']
end

#delete ⇒ Boolean

Deletes the TrunkInstance

Returns:

  • (Boolean) —

    true if delete succeeds, true otherwise



544
545
546
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 544

def delete
  context.delete
end

#disaster_recovery_method ⇒ String

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



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

def disaster_recovery_method
  @properties['disaster_recovery_method']
end

#disaster_recovery_url ⇒ String

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



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

def disaster_recovery_url
  @properties['disaster_recovery_url']
end

#domain_name ⇒ String

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



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

def domain_name
  @properties['domain_name']
end

#fetch ⇒ TrunkInstance

Fetch a TrunkInstance

Returns:



537
538
539
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 537

def fetch
  context.fetch
end

#friendly_name ⇒ String

Returns The string that you assigned to describe the resource.

Returns:

  • (String) —

    The string that you assigned to describe the resource



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

def friendly_name
  @properties['friendly_name']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



636
637
638
639
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 636

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

#ip_access_control_lists ⇒ ip_access_control_lists

Access the ip_access_control_lists

Returns:



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

def ip_access_control_lists
  context.ip_access_control_lists
end

Returns The URLs of related resources.

Returns:

  • (String) —

    The URLs of related resources



530
531
532
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 530

def links
  @properties['links']
end

#origination_urls ⇒ origination_urls

Access the origination_urls

Returns:



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

def origination_urls
  context.origination_urls
end

#phone_numbers ⇒ phone_numbers

Access the phone_numbers

Returns:



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

def phone_numbers
  context.phone_numbers
end

#recording ⇒ Hash

Returns The recording settings for the trunk.

Returns:

  • (Hash) —

    The recording settings for the trunk



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

def recording
  @properties['recording']
end

#secure ⇒ Boolean

Returns Whether Secure Trunking is enabled for the trunk.

Returns:

  • (Boolean) —

    Whether Secure Trunking is enabled for the trunk



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

def secure
  @properties['secure']
end

#sid ⇒ String

Returns The unique string that identifies the resource.

Returns:

  • (String) —

    The unique string that identifies the resource



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

def sid
  @properties['sid']
end

#terminating_sip_domains ⇒ terminating_sip_domains

Access the terminating_sip_domains

Returns:



623
624
625
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 623

def terminating_sip_domains
  context.terminating_sip_domains
end

#to_s ⇒ Object

Provide a user friendly representation



629
630
631
632
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 629

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

#update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, recording: :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.

  • recording (trunk.RecordingSetting) (defaults to: :unset) —

    The recording settings for the trunk. Can be: do-not-record, record-from-ringing, record-from-answer. If set to record-from-ringing or record-from-answer, all calls going through the trunk will be recorded. See Recording 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:



580
581
582
583
584
585
586
587
588
589
590
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 580

def update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, recording: :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,
      recording: recording,
      secure: secure,
      cnam_lookup_enabled: cnam_lookup_enabled,
  )
end

#url ⇒ String

Returns The absolute URL of the resource.

Returns:

  • (String) —

    The absolute URL of the resource



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

def url
  @properties['url']
end