Class: Twilio::REST::Insights::V3::CustomFieldMappingInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, mapping_id: nil) ⇒ CustomFieldMappingInstance

Initialize the CustomFieldMappingInstance

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

  • sid (String) —

    The SID of the Call resource to fetch.



658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 658

def initialize(version, payload , mapping_id: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'id' => payload['id'],
        'category' => payload['category'],
        'name' => payload['name'],
        'description' => payload['description'],
        'entity_metadata' => payload['entity_metadata'],
        'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
        'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
    }

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

Instance Method Details

#category ⇒ MappingCategory

Returns:

  • (MappingCategory)


698
699
700
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 698

def category
    @properties['category']
end

#context ⇒ CustomFieldMappingContext

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

Returns:



683
684
685
686
687
688
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 683

def context
    unless @instance_context
        @instance_context = CustomFieldMappingContext.new(@version , @params['mapping_id'])
    end
    @instance_context
end

#created_at ⇒ Time

Returns When the mapping was registered.

Returns:

  • (Time) —

    When the mapping was registered.



722
723
724
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 722

def created_at
    @properties['created_at']
end

#description ⇒ String

Returns Optional, free-text description supplied at registration time. Display-only — not part of any uniqueness check.

Returns:

  • (String) —

    Optional, free-text description supplied at registration time. Display-only — not part of any uniqueness check.



710
711
712
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 710

def description
    @properties['description']
end

#entity_metadata ⇒ EntityMetadata

Returns:

  • (EntityMetadata)


716
717
718
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 716

def 
    @properties['entity_metadata']
end

#fetch ⇒ CustomFieldMappingInstance

Fetch the CustomFieldMappingInstance

Returns:



735
736
737
738
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 735

def fetch

    context.fetch
end

#id ⇒ String

Returns The unique identifier of the custom field mapping.

Returns:

  • (String) —

    The unique identifier of the custom field mapping.



692
693
694
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 692

def id
    @properties['id']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



765
766
767
768
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 765

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

#name ⇒ String

Returns Name of the custom field, unique within the account.

Returns:

  • (String) —

    Name of the custom field, unique within the account.



704
705
706
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 704

def name
    @properties['name']
end

#patch(if_match: :unset, custom_field_mapping_update_request: nil) ⇒ CustomFieldMappingInstance

Patch the CustomFieldMappingInstance

Parameters:

  • if_match (String) (defaults to: :unset) —

    ETag of the custom field mapping, as returned in the ETag response header. When supplied, the update is applied only if the mapping has not changed since that ETag was issued; otherwise 412 is returned.

  • custom_field_mapping_update_request (CustomFieldMappingUpdateRequest) (defaults to: nil)

Returns:



745
746
747
748
749
750
751
752
753
754
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 745

def patch(
  if_match: :unset,
  custom_field_mapping_update_request: nil
)

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

#to_s ⇒ Object

Provide a user friendly representation



758
759
760
761
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 758

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

#updated_at ⇒ Time

Returns When the mapping was last modified via PATCH. Null until the first update.

Returns:

  • (Time) —

    When the mapping was last modified via PATCH. Null until the first update.



728
729
730
# File 'lib/twilio-ruby/rest/insights/v3/custom_field_mapping.rb', line 728

def updated_at
    @properties['updated_at']
end