Class: Twilio::REST::Memory::V1::TraitGroupContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/memory/v1/trait_group.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, store_id, trait_group_name) ⇒ TraitGroupContext

Initialize the TraitGroupContext

Parameters:

  • version (Version)

    Version that contains the resource

  • store_id (String)

    A unique Memory Store ID using Twilio Type ID (TTID) format

  • trait_group_name (String)

    A unique Name of the TraitGroup



465
466
467
468
469
470
471
472
473
474
475
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 465

def initialize(version, store_id, trait_group_name)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)

    # Path Solution
    @solution = { store_id: store_id, trait_group_name: trait_group_name,  }
    @uri = "/ControlPlane/Stores/#{@solution[:store_id]}/TraitGroups/#{@solution[:trait_group_name]}"

    
end

Instance Method Details

#deleteBoolean

Delete the TraitGroupInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 479

def delete

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

#delete_with_metadataBoolean

Delete the TraitGroupInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 498

def 

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

#fetch(include_traits: :unset, page_size: :unset, page_token: :unset, order_by: :unset) ⇒ TraitGroupInstance

Fetch the TraitGroupInstance

Parameters:

  • include_traits (Boolean) (defaults to: :unset)

    Whether to include trait definitions in the response

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

    The maximum number of items to return per page, maximum of 100.

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

    The token for the page of results to retrieve.

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

    Either 'ASC' or 'DESC' to sort results ascending or descending respectively.

Returns:



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/memory/v1/trait_group.rb', line 521

def fetch(
  include_traits: :unset, 
  page_size: :unset, 
  page_token: :unset, 
  order_by: :unset
)

    params = Twilio::Values.of({
        'includeTraits' => include_traits,
        'pageSize' => page_size,
        'pageToken' => page_token,
        'orderBy' => order_by,
    })
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, params: params, headers: headers)
    TraitGroupInstance.new(
        @version,
        payload,
        store_id: @solution[:store_id],
        trait_group_name: @solution[:trait_group_name],
    )
end

#fetch_with_metadata(include_traits: :unset, page_size: :unset, page_token: :unset, order_by: :unset) ⇒ TraitGroupInstance

Fetch the TraitGroupInstanceMetadata

Parameters:

  • include_traits (Boolean) (defaults to: :unset)

    Whether to include trait definitions in the response

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

    The maximum number of items to return per page, maximum of 100.

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

    The token for the page of results to retrieve.

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

    Either 'ASC' or 'DESC' to sort results ascending or descending respectively.

Returns:



556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 556

def (
  include_traits: :unset, 
  page_size: :unset, 
  page_token: :unset, 
  order_by: :unset
)

    params = Twilio::Values.of({
        'includeTraits' => include_traits,
        'pageSize' => page_size,
        'pageToken' => page_token,
        'orderBy' => order_by,
    })
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, params: params, headers: headers)
    trait_group_instance = TraitGroupInstance.new(
        @version,
        response.body,
        store_id: @solution[:store_id],
        trait_group_name: @solution[:trait_group_name],
    )
    TraitGroupInstanceMetadata.new(
        @version,
        trait_group_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



656
657
658
659
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 656

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

#patch(if_match: :unset, patch_trait_group_request: :unset) ⇒ TraitGroupInstance

Patch the TraitGroupInstance

Parameters:

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

    Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches the one provided, preventing accidental overwrites.

  • patch_trait_group_request (PatchTraitGroupRequest) (defaults to: :unset)

Returns:



595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 595

def patch(
  if_match: :unset,
  patch_trait_group_request: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    payload = @version.patch('PATCH', @uri, headers: headers, data: patch_trait_group_request.to_json)
    TraitGroupInstance.new(
        @version,
        payload,
        store_id: @solution[:store_id],
        trait_group_name: @solution[:trait_group_name],
    )
end

#patch_with_metadata(if_match: :unset, patch_trait_group_request: :unset) ⇒ TraitGroupInstance

Patch the TraitGroupInstanceMetadata

Parameters:

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

    Allows for optimistic concurrency control by making the request conditional. Server will only act if the resource's current Entity Tag (ETag) matches the one provided, preventing accidental overwrites.

  • patch_trait_group_request (PatchTraitGroupRequest) (defaults to: :unset)

Returns:



620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 620

def (
  if_match: :unset,
patch_trait_group_request: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, })
    headers['Content-Type'] = 'application/json'
    
    
    
    
    response = @version.('PATCH', @uri, headers: headers, data: patch_trait_group_request.to_json)
    trait_group_instance = TraitGroupInstance.new(
        @version,
        response.body,
        store_id: @solution[:store_id],
        trait_group_name: @solution[:trait_group_name],
    )
    TraitGroupInstanceMetadata.new(
        @version,
        trait_group_instance,
        response.headers,
        response.status_code
    )
end

#to_sObject

Provide a user friendly representation



649
650
651
652
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 649

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