Class: Twilio::REST::Memory::V1::DataMappingInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, store_id: nil, data_mapping_id: nil) ⇒ DataMappingInstance

Initialize the DataMappingInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 685

def initialize(version, payload , store_id: nil, data_mapping_id: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'message' => payload['message'],
        'status_url' => payload['status_url'],
        'display_name' => payload['display_name'],
        'description' => payload['description'],
        'is_enabled' => payload['is_enabled'],
        'mapping_to' => payload['mapping_to'],
        'mapping_from' => payload['mapping_from'],
        'id' => payload['id'],
        'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
        'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
        'version' => payload['version'] == nil ? payload['version'] : payload['version'].to_i,
    }

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

Instance Method Details

#contextDataMappingContext

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

Returns:



714
715
716
717
718
719
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 714

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

#created_atTime

Returns The ISO 8601 timestamp when the data mapping was created.

Returns:

  • (Time)

    The ISO 8601 timestamp when the data mapping was created.



771
772
773
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 771

def created_at
    @properties['created_at']
end

#deleteBoolean

Delete the DataMappingInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



790
791
792
793
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 790

def delete

    context.delete
end

#descriptionString

Returns A human readable description of this resource, up to 512 characters.

Returns:

  • (String)

    A human readable description of this resource, up to 512 characters.



741
742
743
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 741

def description
    @properties['description']
end

#display_nameString

Returns Name of the data mapping.

Returns:

  • (String)

    Name of the data mapping.



735
736
737
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 735

def display_name
    @properties['display_name']
end

#fetchDataMappingInstance

Fetch the DataMappingInstance

Returns:



798
799
800
801
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 798

def fetch

    context.fetch
end

#idString

Returns The unique identifier for the data mapping.

Returns:

  • (String)

    The unique identifier for the data mapping.



765
766
767
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 765

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



828
829
830
831
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 828

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

#is_enabledBoolean

Returns Flag indicating whether the data mapping is active. When true, data will be ingested and mapped according to the configuration. When false, the data mapping will be inactive and no data will be ingested into the Memory Store.

Returns:

  • (Boolean)

    Flag indicating whether the data mapping is active. When true, data will be ingested and mapped according to the configuration. When false, the data mapping will be inactive and no data will be ingested into the Memory Store.



747
748
749
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 747

def is_enabled
    @properties['is_enabled']
end

#mapping_fromDataMappingFromTypes

Returns:

  • (DataMappingFromTypes)


759
760
761
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 759

def mapping_from
    @properties['mapping_from']
end

#mapping_toDataMappingToTraits

Returns:

  • (DataMappingToTraits)


753
754
755
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 753

def mapping_to
    @properties['mapping_to']
end

#messageString

Returns:

  • (String)


723
724
725
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 723

def message
    @properties['message']
end

#patch(if_match: :unset, data_mapping_core: :unset) ⇒ DataMappingInstance

Patch the DataMappingInstance

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.

  • data_mapping_core (DataMappingCore) (defaults to: :unset)

Returns:



808
809
810
811
812
813
814
815
816
817
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 808

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

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

#status_urlString

Returns URI to check operation status.

Returns:

  • (String)

    URI to check operation status.



729
730
731
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 729

def status_url
    @properties['status_url']
end

#to_sObject

Provide a user friendly representation



821
822
823
824
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 821

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

#updated_atTime

Returns The ISO 8601 timestamp when the data mapping was last updated.

Returns:

  • (Time)

    The ISO 8601 timestamp when the data mapping was last updated.



777
778
779
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 777

def updated_at
    @properties['updated_at']
end

#versionString

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

Returns:

  • (String)

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



783
784
785
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 783

def version
    @properties['version']
end