Class: Twilio::REST::Numbers::V2::RegulatoryComplianceList::BundleContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb,
lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb,
lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb,
lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/replace_items.rb,
lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/item_assignment.rb

Defined Under Namespace

Classes: BundleCopyInstance, BundleCopyList, BundleCopyListResponse, BundleCopyPage, BundleCopyPageMetadata, EvaluationContext, EvaluationInstance, EvaluationInstanceMetadata, EvaluationList, EvaluationListResponse, EvaluationPage, EvaluationPageMetadata, ItemAssignmentContext, ItemAssignmentInstance, ItemAssignmentInstanceMetadata, ItemAssignmentList, ItemAssignmentListResponse, ItemAssignmentPage, ItemAssignmentPageMetadata, ReplaceItemsInstance, ReplaceItemsList, ReplaceItemsListResponse, ReplaceItemsPage, ReplaceItemsPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ BundleContext

Initialize the BundleContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The unique string that we created to identify the Bundle resource.



347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 347

def initialize(version, sid)
    super(version)
    

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

    # Dependents
    @replace_items = nil
    @bundle_copies = nil
    @item_assignments = nil
    @evaluations = nil
end

Instance Method Details

#bundle_copiesBundleCopyList, BundleCopyContext

Access the bundle_copies

Returns:



528
529
530
531
532
533
534
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 528

def bundle_copies
  unless @bundle_copies
    @bundle_copies = BundleCopyList.new(
            @version, bundle_sid: @solution[:sid], )
  end
  @bundle_copies
end

#deleteBoolean

Delete the BundleInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



364
365
366
367
368
369
370
371
372
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.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 BundleInstanceMetadata

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/numbers/v2/regulatory_compliance/bundle.rb', line 377

def 

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

#evaluations(sid = :unset) ⇒ EvaluationList, EvaluationContext

Access the evaluations

Returns:

Raises:

  • (ArgumentError)


558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 558

def evaluations(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return EvaluationContext.new(@version, @solution[:sid],sid )
    end

    unless @evaluations
        @evaluations = EvaluationList.new(
            @version, bundle_sid: @solution[:sid], )
    end

 @evaluations
end

#fetchBundleInstance

Fetch the BundleInstance

Returns:



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

def fetch

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

#fetch_with_metadataBundleInstance

Fetch the BundleInstanceMetadata

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/numbers/v2/regulatory_compliance/bundle.rb', line 415

def 

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

#inspectObject

Provide a detailed, user friendly representation



583
584
585
586
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 583

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

#item_assignments(sid = :unset) ⇒ ItemAssignmentList, ItemAssignmentContext

Access the item_assignments

Returns:

Raises:

  • (ArgumentError)


539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 539

def item_assignments(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return ItemAssignmentContext.new(@version, @solution[:sid],sid )
    end

    unless @item_assignments
        @item_assignments = ItemAssignmentList.new(
            @version, bundle_sid: @solution[:sid], )
    end

 @item_assignments
end

#replace_itemsReplaceItemsList, ReplaceItemsContext

Access the replace_items

Returns:



517
518
519
520
521
522
523
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 517

def replace_items
  unless @replace_items
    @replace_items = ReplaceItemsList.new(
            @version, bundle_sid: @solution[:sid], )
  end
  @replace_items
end

#to_sObject

Provide a user friendly representation



576
577
578
579
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 576

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

#update(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset) ⇒ BundleInstance

Update the BundleInstance

Parameters:

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

    The URL we call to inform your application of status changes.

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

    The string that you assigned to describe the resource.

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

    The email address that will receive updates when the Bundle resource changes status.

Returns:



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
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 444

def update(
    status: :unset, 
    status_callback: :unset, 
    friendly_name: :unset, 
    email: :unset
)

    data = Twilio::Values.of({
        'Status' => status,
        'StatusCallback' => status_callback,
        'FriendlyName' => friendly_name,
        'Email' => email,
    })

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

#update_with_metadata(status: :unset, status_callback: :unset, friendly_name: :unset, email: :unset) ⇒ BundleInstance

Update the BundleInstanceMetadata

Parameters:

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

    The URL we call to inform your application of status changes.

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

    The string that you assigned to describe the resource.

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

    The email address that will receive updates when the Bundle resource changes status.

Returns:



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb', line 479

def (
  status: :unset, 
  status_callback: :unset, 
  friendly_name: :unset, 
  email: :unset
)

    data = Twilio::Values.of({
        'Status' => status,
        'StatusCallback' => status_callback,
        'FriendlyName' => friendly_name,
        'Email' => email,
    })

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