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



277
278
279
280
281
282
283
284
285
286
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 277

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#deleteBoolean

Delete the ByocTrunkInstance



290
291
292
293
294
295
296
297
298
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 290

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the ByocTrunkInstanceMetadata



303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 303

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      byocTrunk_instance = ByocTrunkInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      ByocTrunkInstanceMetadata.new(@version, byocTrunk_instance, response.headers, response.status_code)
end

#fetchByocTrunkInstance

Fetch the ByocTrunkInstance



322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 322

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    ByocTrunkInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#fetch_with_metadataByocTrunkInstance

Fetch the ByocTrunkInstanceMetadata



341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 341

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    byoc_trunk_instance = ByocTrunkInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    ByocTrunkInstanceMetadata.new(
        @version,
        byoc_trunk_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



485
486
487
488
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 485

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

#to_sObject

Provide a user friendly representation



478
479
480
481
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 478

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



376
377
378
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
406
407
408
409
410
411
412
413
414
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 376

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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    ByocTrunkInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#update_with_metadata(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 ByocTrunkInstanceMetadata



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
# File 'lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb', line 429

def (
  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,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    byoc_trunk_instance = ByocTrunkInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    ByocTrunkInstanceMetadata.new(
        @version,
        byoc_trunk_instance,
        response.headers,
        response.status_code
    )
end