Class: Twilio::REST::Preview::HostedNumbers::AuthorizationDocumentContext

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

Defined Under Namespace

Classes: DependentHostedNumberOrderInstance, DependentHostedNumberOrderList, DependentHostedNumberOrderListResponse, DependentHostedNumberOrderPage, DependentHostedNumberOrderPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ AuthorizationDocumentContext

Initialize the AuthorizationDocumentContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    A 34 character string that uniquely identifies this AuthorizationDocument.



269
270
271
272
273
274
275
276
277
278
279
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 269

def initialize(version, sid)
    super(version)
    

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

    # Dependents
    @dependent_hosted_number_orders = nil
end

Instance Method Details

#dependent_hosted_number_ordersDependentHostedNumberOrderList, DependentHostedNumberOrderContext

Access the dependent_hosted_number_orders

Returns:



422
423
424
425
426
427
428
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 422

def dependent_hosted_number_orders
  unless @dependent_hosted_number_orders
    @dependent_hosted_number_orders = DependentHostedNumberOrderList.new(
            @version, signing_document_sid: @solution[:sid], )
  end
  @dependent_hosted_number_orders
end

#fetchAuthorizationDocumentInstance

Fetch the AuthorizationDocumentInstance

Returns:



283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 283

def fetch

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

#fetch_with_metadataAuthorizationDocumentInstance

Fetch the AuthorizationDocumentInstanceMetadata

Returns:



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 302

def 

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

#inspectObject

Provide a detailed, user friendly representation



439
440
441
442
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 439

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

#to_sObject

Provide a user friendly representation



432
433
434
435
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 432

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

#update(hosted_number_order_sids: :unset, address_sid: :unset, email: :unset, cc_emails: :unset, status: :unset, contact_title: :unset, contact_phone_number: :unset) ⇒ AuthorizationDocumentInstance

Update the AuthorizationDocumentInstance

Parameters:

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

    A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio’s platform.

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

    A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument.

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

    Email that this AuthorizationDocument will be sent to for signing.

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

    Email recipients who will be informed when an Authorization Document has been sent and signed

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

    The title of the person authorized to sign the Authorization Document for this phone number.

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

    The contact phone number of the person authorized to sign the Authorization Document.

Returns:



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 334

def update(
  hosted_number_order_sids: :unset, 
  address_sid: :unset, 
  email: :unset, 
  cc_emails: :unset, 
  status: :unset, 
  contact_title: :unset, 
  contact_phone_number: :unset
)

    data = Twilio::Values.of({
        'HostedNumberOrderSids' => Twilio.serialize_list(hosted_number_order_sids) { |e| e },
        'AddressSid' => address_sid,
        'Email' => email,
        'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
        'Status' => status,
        'ContactTitle' => contact_title,
        'ContactPhoneNumber' => contact_phone_number,
    })

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

#update_with_metadata(hosted_number_order_sids: :unset, address_sid: :unset, email: :unset, cc_emails: :unset, status: :unset, contact_title: :unset, contact_phone_number: :unset) ⇒ AuthorizationDocumentInstance

Update the AuthorizationDocumentInstanceMetadata

Parameters:

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

    A list of HostedNumberOrder sids that this AuthorizationDocument will authorize for hosting phone number capabilities on Twilio’s platform.

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

    A 34 character string that uniquely identifies the Address resource that is associated with this AuthorizationDocument.

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

    Email that this AuthorizationDocument will be sent to for signing.

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

    Email recipients who will be informed when an Authorization Document has been sent and signed

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

    The title of the person authorized to sign the Authorization Document for this phone number.

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

    The contact phone number of the person authorized to sign the Authorization Document.

Returns:



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
415
416
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 378

def (
  hosted_number_order_sids: :unset, 
  address_sid: :unset, 
  email: :unset, 
  cc_emails: :unset, 
  status: :unset, 
  contact_title: :unset, 
  contact_phone_number: :unset
)

    data = Twilio::Values.of({
        'HostedNumberOrderSids' => Twilio.serialize_list(hosted_number_order_sids) { |e| e },
        'AddressSid' => address_sid,
        'Email' => email,
        'CcEmails' => Twilio.serialize_list(cc_emails) { |e| e },
        'Status' => status,
        'ContactTitle' => contact_title,
        'ContactPhoneNumber' => contact_phone_number,
    })

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