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.



261
262
263
264
265
266
267
268
269
270
271
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 261

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:



414
415
416
417
418
419
420
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 414

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:



275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 275

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:



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 294

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],
    )
    .new(
        @version,
        authorization_document_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



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

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:



326
327
328
329
330
331
332
333
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
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 326

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:



370
371
372
373
374
375
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
# File 'lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb', line 370

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],
    )
    .new(
        @version,
        authorization_document_instance,
        response.headers,
        response.status_code
    )
end