Class: Twilio::REST::Memory::V1::TraitGroupInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, store_id: nil, trait_group_name: nil) ⇒ TraitGroupInstance

Initialize the TraitGroupInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this TraitGroup resource.

  • sid (String)

    The SID of the Call resource to fetch.



759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 759

def initialize(version, payload , store_id: nil, trait_group_name: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'message' => payload['message'],
        'status_url' => payload['status_url'],
        'trait_group' => payload['trait_group'],
        'meta' => payload['meta'],
        'display_name' => payload['display_name'],
        'description' => payload['description'],
        'traits' => payload['traits'],
        'version' => payload['version'] == nil ? payload['version'] : payload['version'].to_i,
    }

    # Context
    @instance_context = nil
    @params = { 'store_id' => store_id  || @properties['store_id']  ,'trait_group_name' => trait_group_name  || @properties['trait_group_name']  , }
end

Instance Method Details

#contextTraitGroupContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



785
786
787
788
789
790
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 785

def context
    unless @instance_context
        @instance_context = TraitGroupContext.new(@version , @params['store_id'], @params['trait_group_name'])
    end
    @instance_context
end

#deleteBoolean

Delete the TraitGroupInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



843
844
845
846
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 843

def delete

    context.delete
end

#descriptionString

Returns description of the Trait Group.

Returns:

  • (String)

    description of the Trait Group



824
825
826
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 824

def description
    @properties['description']
end

#display_nameString

Returns Provides a unique and addressable name to be assigned to this Trait Group.

Returns:

  • (String)

    Provides a unique and addressable name to be assigned to this Trait Group



818
819
820
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 818

def display_name
    @properties['display_name']
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:



855
856
857
858
859
860
861
862
863
864
865
866
867
868
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 855

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

    context.fetch(
        include_traits: include_traits, 
        page_size: page_size, 
        page_token: page_token, 
        order_by: order_by, 
    )
end

#inspectObject

Provide a detailed, user friendly representation



895
896
897
898
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 895

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Memory.V1.TraitGroupInstance #{values}>"
end

#messageString

Returns:

  • (String)


794
795
796
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 794

def message
    @properties['message']
end

#metaMeta

Returns:

  • (Meta)


812
813
814
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 812

def meta
    @properties['meta']
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:



875
876
877
878
879
880
881
882
883
884
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 875

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

    context.patch(
        if_match: if_match, 
        patch_trait_group_request: patch_trait_group_request, 
    )
end

#status_urlString

Returns URI to check operation status.

Returns:

  • (String)

    URI to check operation status.



800
801
802
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 800

def status_url
    @properties['status_url']
end

#to_sObject

Provide a user friendly representation



888
889
890
891
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 888

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Memory.V1.TraitGroupInstance #{values}>"
end

#trait_groupTraitGroup

Returns:

  • (TraitGroup)


806
807
808
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 806

def trait_group
    @properties['trait_group']
end

#traitsHash<String, TraitGroupCoreTraitsValue>

Returns Map of traits that are part of this Trait Group, where the key is the trait name and the value is the trait’s definition.

Returns:

  • (Hash<String, TraitGroupCoreTraitsValue>)

    Map of traits that are part of this Trait Group, where the key is the trait name and the value is the trait’s definition.



830
831
832
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 830

def traits
    @properties['traits']
end

#versionString

Returns The current version number of the Trait Group. Incremented on each successful update.

Returns:

  • (String)

    The current version number of the Trait Group. Incremented on each successful update.



836
837
838
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 836

def version
    @properties['version']
end