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 that contains the resource

  • payload that contains response from Twilio

  • The SID of the Account that created this TraitGroup resource.

  • The SID of the Call resource to fetch.



809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 809

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:

  • CallContext for this CallInstance



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

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:

  • True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#descriptionString

Returns description of the Trait Group.

Returns:

  • description of the Trait Group



874
875
876
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 874

def description
    @properties['description']
end

#display_nameString

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

Returns:

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



868
869
870
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 868

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:

  • (defaults to: :unset)

    Whether to include trait definitions in the response

  • (defaults to: :unset)

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

  • (defaults to: :unset)

    The token for the page of results to retrieve.

  • (defaults to: :unset)

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

Returns:

  • Fetched TraitGroupInstance



905
906
907
908
909
910
911
912
913
914
915
916
917
918
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 905

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



945
946
947
948
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 945

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

#messageString

Returns:



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

def message
    @properties['message']
end

#metaMeta

Returns:



862
863
864
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 862

def meta
    @properties['meta']
end

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

Patch the TraitGroupInstance

Parameters:

  • (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.

  • (defaults to: :unset)

Returns:

  • Patched TraitGroupInstance



925
926
927
928
929
930
931
932
933
934
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 925

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:

  • URI to check operation status.



850
851
852
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 850

def status_url
    @properties['status_url']
end

#to_sObject

Provide a user friendly representation



938
939
940
941
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 938

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

#trait_groupTraitGroup

Returns:



856
857
858
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 856

def trait_group
    @properties['trait_group']
end

#traitsHash<String, TraitGroupCoreTraits>

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:

  • 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.



880
881
882
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 880

def traits
    @properties['traits']
end

#versionString

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

Returns:

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



886
887
888
# File 'lib/twilio-ruby/rest/memory/v1/trait_group.rb', line 886

def version
    @properties['version']
end