Class: Twilio::REST::Voice::V1::ByocTrunkContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ ByocTrunkContext

Initialize the ByocTrunkContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The Twilio-provided string that uniquely identifies the BYOC Trunk resource to fetch.


198
199
200
201
202
203
204
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 198

def initialize(version, sid)
  super(version)

  # Path Solution
  @solution = {sid: sid, }
  @uri = "/ByocTrunks/#{@solution[:sid]}"
end

Instance Method Details

#deleteBoolean

Delete the ByocTrunkInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


266
267
268
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 266

def delete
   @version.delete('DELETE', @uri)
end

#fetchByocTrunkInstance

Fetch the ByocTrunkInstance

Returns:


209
210
211
212
213
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 209

def fetch
  payload = @version.fetch('GET', @uri)

  ByocTrunkInstance.new(@version, payload, sid: @solution[:sid], )
end

#inspectObject

Provide a detailed, user friendly representation


279
280
281
282
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 279

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Voice.V1.ByocTrunkContext #{context}>"
end

#to_sObject

Provide a user friendly representation


272
273
274
275
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 272

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Voice.V1.ByocTrunkContext #{context}>"
end

#update(friendly_name: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, cnam_lookup_enabled: :unset, connection_policy_sid: :unset, from_domain_sid: :unset) ⇒ ByocTrunkInstance

Update the ByocTrunkInstance

Parameters:

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

    A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.

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

    The URL we should call when the BYOC Trunk receives a call.

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

    The HTTP method we should use to call `voice_url`

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

    The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`.

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

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

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

    The URL that we should call to pass status parameters (such as call ended) to your application.

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

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

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

    Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC 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.

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

    The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.

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

    The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to “call back” an incoming call, configure this with a SIP Domain to ensure proper routing. If not configured, the from domain will default to “sip.twilio.com”.

Returns:


244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 244

def update(friendly_name: :unset, voice_url: :unset, voice_method: :unset, voice_fallback_url: :unset, voice_fallback_method: :unset, status_callback_url: :unset, status_callback_method: :unset, cnam_lookup_enabled: :unset, connection_policy_sid: :unset, from_domain_sid: :unset)
  data = Twilio::Values.of({
      'FriendlyName' => friendly_name,
      'VoiceUrl' => voice_url,
      'VoiceMethod' => voice_method,
      'VoiceFallbackUrl' => voice_fallback_url,
      'VoiceFallbackMethod' => voice_fallback_method,
      'StatusCallbackUrl' => status_callback_url,
      'StatusCallbackMethod' => status_callback_method,
      'CnamLookupEnabled' => cnam_lookup_enabled,
      'ConnectionPolicySid' => connection_policy_sid,
      'FromDomainSid' => from_domain_sid,
  })

  payload = @version.update('POST', @uri, data: data)

  ByocTrunkInstance.new(@version, payload, sid: @solution[:sid], )
end