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.



691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 691

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:



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

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.



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

def created_at
    @properties['created_at']
end

#deleteBoolean

Delete the DataMappingInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

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.



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

def description
    @properties['description']
end

#display_nameString

Returns Name of the data mapping.

Returns:

  • (String)

    Name of the data mapping.



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

def display_name
    @properties['display_name']
end

#fetchDataMappingInstance

Fetch the DataMappingInstance

Returns:



804
805
806
807
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 804

def fetch

    context.fetch
end

#idString

Returns The unique identifier for the data mapping.

Returns:

  • (String)

    The unique identifier for the data mapping.



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

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



834
835
836
837
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 834

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.



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

def is_enabled
    @properties['is_enabled']
end

#mapping_fromDataMappingFromDataSet

Returns:

  • (DataMappingFromDataSet)


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

def mapping_from
    @properties['mapping_from']
end

#mapping_toDataMappingToTraits

Returns:

  • (DataMappingToTraits)


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

def mapping_to
    @properties['mapping_to']
end

#messageString

Returns:

  • (String)


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

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:



814
815
816
817
818
819
820
821
822
823
# File 'lib/twilio-ruby/rest/memory/v1/data_mapping.rb', line 814

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.



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

def status_url
    @properties['status_url']
end

#to_sObject

Provide a user friendly representation



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

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.



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

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.



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

def version
    @properties['version']
end