Class: Twilio::REST::Preview::HostedNumbers::HostedNumberOrderContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ HostedNumberOrderContext

Initialize the HostedNumberOrderContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    A 34 character string that uniquely identifies this HostedNumberOrder.



351
352
353
354
355
356
357
358
359
360
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 351

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#deleteBoolean

Delete the HostedNumberOrderInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



364
365
366
367
368
369
370
371
372
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 364

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 HostedNumberOrderInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 377

def 

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

#fetchHostedNumberOrderInstance

Fetch the HostedNumberOrderInstance

Returns:



396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 396

def fetch

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

#fetch_with_metadataHostedNumberOrderInstance

Fetch the HostedNumberOrderInstanceMetadata

Returns:



415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 415

def 

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

#inspectObject

Provide a detailed, user friendly representation



559
560
561
562
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 559

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

#to_sObject

Provide a user friendly representation



552
553
554
555
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 552

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

#update(friendly_name: :unset, unique_name: :unset, email: :unset, cc_emails: :unset, status: :unset, verification_code: :unset, verification_type: :unset, verification_document_sid: :unset, extension: :unset, call_delay: :unset) ⇒ HostedNumberOrderInstance

Update the HostedNumberOrderInstance

Parameters:

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

    A 64 character string that is a human readable text that describes this resource.

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

    Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID.

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

    Email of the owner of this phone number that is being hosted.

  • cc_emails (Array[String]) (defaults to: :unset)

    Optional. A list of emails that LOA document for this HostedNumberOrder will be carbon copied to.

  • status (Status) (defaults to: :unset)
  • verification_code (String) (defaults to: :unset)

    A verification code that is given to the user via a phone call to the phone number that is being hosted.

  • verification_type (VerificationType) (defaults to: :unset)
  • verification_document_sid (String) (defaults to: :unset)

    Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill.

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

    Digits to dial after connecting the verification call.

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

    The number of seconds, between 0 and 60, to delay before initiating the verification call. Defaults to 0.

Returns:



450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 450

def update(
    friendly_name: :unset, 
    unique_name: :unset, 
    email: :unset, 
    cc_emails: :unset, 
    status: :unset, 
    verification_code: :unset, 
    verification_type: :unset, 
    verification_document_sid: :unset, 
    extension: :unset, 
    call_delay: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'UniqueName' => unique_name,
        'Email' => email,
        'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
        'Status' => status,
        'VerificationCode' => verification_code,
        'VerificationType' => verification_type,
        'VerificationDocumentSid' => verification_document_sid,
        'Extension' => extension,
        'CallDelay' => call_delay,
    })

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

#update_with_metadata(friendly_name: :unset, unique_name: :unset, email: :unset, cc_emails: :unset, status: :unset, verification_code: :unset, verification_type: :unset, verification_document_sid: :unset, extension: :unset, call_delay: :unset) ⇒ HostedNumberOrderInstance

Update the HostedNumberOrderInstanceMetadata

Parameters:

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

    A 64 character string that is a human readable text that describes this resource.

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

    Provides a unique and addressable name to be assigned to this HostedNumberOrder, assigned by the developer, to be optionally used in addition to SID.

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

    Email of the owner of this phone number that is being hosted.

  • cc_emails (Array[String]) (defaults to: :unset)

    Optional. A list of emails that LOA document for this HostedNumberOrder will be carbon copied to.

  • status (Status) (defaults to: :unset)
  • verification_code (String) (defaults to: :unset)

    A verification code that is given to the user via a phone call to the phone number that is being hosted.

  • verification_type (VerificationType) (defaults to: :unset)
  • verification_document_sid (String) (defaults to: :unset)

    Optional. The unique sid identifier of the Identity Document that represents the document for verifying ownership of the number to be hosted. Required when VerificationType is phone-bill.

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

    Digits to dial after connecting the verification call.

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

    The number of seconds, between 0 and 60, to delay before initiating the verification call. Defaults to 0.

Returns:



503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 503

def (
  friendly_name: :unset, 
  unique_name: :unset, 
  email: :unset, 
  cc_emails: :unset, 
  status: :unset, 
  verification_code: :unset, 
  verification_type: :unset, 
  verification_document_sid: :unset, 
  extension: :unset, 
  call_delay: :unset
)

    data = Twilio::Values.of({
        'FriendlyName' => friendly_name,
        'UniqueName' => unique_name,
        'Email' => email,
        'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
        'Status' => status,
        'VerificationCode' => verification_code,
        'VerificationType' => verification_type,
        'VerificationDocumentSid' => verification_document_sid,
        'Extension' => extension,
        'CallDelay' => call_delay,
    })

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