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 sid



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 362

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'],
      '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 unique ID of the Account that owns this Trunk.

Returns:

  • (String)

    The unique ID of the Account that owns this Trunk.



401
402
403
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 401

def 
  @properties['account_sid']
end

#auth_typeString

Returns The types of authentication you have mapped to your domain.

Returns:

  • (String)

    The types of authentication you have mapped to your domain.



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

def auth_type
  @properties['auth_type']
end

#auth_type_setString

Returns The auth_type_set.

Returns:

  • (String)

    The auth_type_set



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

def auth_type_set
  @properties['auth_type_set']
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:



392
393
394
395
396
397
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 392

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

#credentials_listscredentials_lists

Access the credentials_lists

Returns:



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

def credentials_lists
  context.credentials_lists
end

#date_createdTime

Returns The date this Activity was created.

Returns:

  • (Time)

    The date this Activity was created.



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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Activity was updated.

Returns:

  • (Time)

    The date this Activity was updated.



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the TrunkInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



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

def delete
  context.delete
end

#disaster_recovery_methodString

Returns The HTTP method Twilio will use when requesting the DisasterRecoveryUrl.

Returns:

  • (String)

    The HTTP method Twilio will use when requesting the DisasterRecoveryUrl.



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

def disaster_recovery_method
  @properties['disaster_recovery_method']
end

#disaster_recovery_urlString

Returns The HTTP URL that Twilio will request if an error occurs while sending SIP traffic towards your configured Origination URL.

Returns:

  • (String)

    The HTTP URL that Twilio will request if an error occurs while sending SIP traffic towards your configured Origination URL.



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

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.



407
408
409
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 407

def domain_name
  @properties['domain_name']
end

#fetchTrunkInstance

Fetch a TrunkInstance

Returns:



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

def fetch
  context.fetch
end

#friendly_nameString

Returns A human-readable name for the Trunk.

Returns:

  • (String)

    A human-readable name for the Trunk.



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

def friendly_name
  @properties['friendly_name']
end

#inspectObject

Provide a detailed, user friendly representation



570
571
572
573
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 570

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:



550
551
552
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 550

def ip_access_control_lists
  context.ip_access_control_lists
end

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#origination_urlsorigination_urls

Access the origination_urls

Returns:



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

def origination_urls
  context.origination_urls
end

#phone_numbersphone_numbers

Access the phone_numbers

Returns:



557
558
559
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 557

def phone_numbers
  context.phone_numbers
end

#recordingHash

Returns The recording settings for this trunk.

Returns:

  • (Hash)

    The recording settings for this trunk.



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

def recording
  @properties['recording']
end

#secureBoolean

Returns The Secure Trunking settings for this trunk.

Returns:

  • (Boolean)

    The Secure Trunking settings for this trunk.



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

def secure
  @properties['secure']
end

#sidString

Returns A 34 character string that uniquely identifies the SIP Trunk in Twilio.

Returns:

  • (String)

    A 34 character string that uniquely identifies the SIP Trunk in Twilio.



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

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation



563
564
565
566
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 563

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) ⇒ TrunkInstance

Update the TrunkInstance

Parameters:

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

    A human-readable name for the Trunk.

  • 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 always end with `pstn.twilio.com`. See [Termination Settings](www.twilio.com/docs/sip-trunking/getting-started#termination) for more information.

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

    The HTTP URL that Twilio will request if an error occurs while sending SIP traffic towards your configured Origination URL. Twilio will retrieve TwiML from this URL and execute those instructions like any other normal TwiML call. See [Disaster Recovery](www.twilio.com/docs/sip-trunking/getting-started#disaster-recovery) for more information.

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

    The HTTP method Twilio will use when requesting the ‘DisasterRecoveryUrl`. Either `GET` or `POST`.

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

    The recording settings for this trunk. If turned on, all calls going through this trunk will be recorded and the recording can either start when the call is ringing or when the call is answered. See [Recording](www.twilio.com/docs/sip-trunking/getting-started#recording) for more information.

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

    The Secure Trunking settings for this trunk. If turned on, all calls going through this trunk will be secure using SRTP for media and TLS for signalling. If turned off, then RTP will be used for media. See [Secure Trunking](www.twilio.com/docs/sip-trunking/getting-started#securetrunking) for more information.

Returns:



522
523
524
525
526
527
528
529
530
531
# File 'lib/twilio-ruby/rest/trunking/v1/trunk.rb', line 522

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

#urlString

Returns The URL for this resource, relative to trunking.

Returns:

  • (String)

    The URL for this resource, relative to trunking.



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

def url
  @properties['url']
end