Class: Twilio::REST::Memory::V1::IdentifierInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, store_id: nil, profile_id: nil, id_type: nil) ⇒ IdentifierInstance

Initialize the IdentifierInstance

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 Identifier resource.

  • sid (String)

    The SID of the Call resource to fetch.



613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 613

def initialize(version, payload , store_id: nil, profile_id: nil, id_type: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'message' => payload['message'],
        'id_type' => payload['id_type'],
        'values' => payload['values'],
    }

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

Instance Method Details

#contextIdentifierContext

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

Returns:



634
635
636
637
638
639
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 634

def context
    unless @instance_context
        @instance_context = IdentifierContext.new(@version , @params['store_id'], @params['profile_id'], @params['id_type'])
    end
    @instance_context
end

#delete(remove_all: :unset) ⇒ Boolean

Delete the IdentifierInstance

Parameters:

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

    When true, removes every stored value for the identifier type in a single operation. Defaults to false.

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



663
664
665
666
667
668
669
670
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 663

def delete(
  remove_all: :unset
)

    context.delete(
        remove_all: remove_all, 
    )
end

#fetchIdentifierInstance

Fetch the IdentifierInstance

Returns:



675
676
677
678
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 675

def fetch

    context.fetch
end

#id_typeString

Returns Identifier type defined in Identity Resolution Settings.

Returns:

  • (String)

    Identifier type defined in Identity Resolution Settings.



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

def id_type
    @properties['id_type']
end

#inspectObject

Provide a detailed, user friendly representation



701
702
703
704
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 701

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

#messageString

Returns:

  • (String)


643
644
645
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 643

def message
    @properties['message']
end

#patch(identifier_update: nil) ⇒ IdentifierInstance

Patch the IdentifierInstance

Parameters:

  • identifier_update (IdentifierUpdate) (defaults to: nil)

Returns:



684
685
686
687
688
689
690
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 684

def patch(identifier_update: nil
)

    context.patch(
        identifier_update: identifier_update, 
    )
end

#to_sObject

Provide a user friendly representation



694
695
696
697
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 694

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

#valuesArray<String>

Returns Server managed collection of stored values for the identifier type. Identifier values are normalized according to the corresponding identifier settings and ordered chronologically.

Returns:

  • (Array<String>)

    Server managed collection of stored values for the identifier type. Identifier values are normalized according to the corresponding identifier settings and ordered chronologically.



655
656
657
# File 'lib/twilio-ruby/rest/memory/v1/identifier.rb', line 655

def values
    @properties['values']
end