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

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

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.



285
286
287
288
289
290
291
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 285

def initialize(version, sid)
  super(version)

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

Instance Method Details

#deleteBoolean

Deletes the HostedNumberOrderInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



311
312
313
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 311

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

#fetchHostedNumberOrderInstance

Fetch a HostedNumberOrderInstance

Returns:



296
297
298
299
300
301
302
303
304
305
306
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 296

def fetch
  params = Twilio::Values.of({})

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

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

#to_sObject

Provide a user friendly representation



360
361
362
363
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 360

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

Update the HostedNumberOrderInstance

Parameters:

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

    A human readable description of this resource, up to 64 characters.

  • 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 (String) (defaults to: :unset)

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

  • status (hosted_number_order.Status) (defaults to: :unset)

    The Status of this HostedNumberOrder. User can only update this to ‘pending-loa` or `pending-verification`.

  • 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 (hosted_number_order.VerificationType) (defaults to: :unset)

    Optional. The method used for verifying ownership of the number to be hosted. One of phone-call (default) or phone-bill.

  • 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.

Returns:



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb', line 337

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

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

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