Class: Twilio::REST::Memory::V1::ObservationInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, store_id: nil, profile_id: nil, observation_id: nil) ⇒ ObservationInstance

Initialize the ObservationInstance

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

  • sid (String)

    The SID of the Call resource to fetch.



711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 711

def initialize(version, payload , store_id: nil, profile_id: nil, observation_id: nil)
    
    apiV1Version = ApiV1Version.new version.domain, version
    super(apiV1Version)
    
    # Marshaled Properties
    @properties = { 
        'message' => payload['message'],
        'content' => payload['content'],
        'occurred_at' => Twilio.deserialize_iso8601_datetime(payload['occurred_at']),
        'source' => payload['source'],
        'conversation_ids' => payload['conversation_ids'],
        'id' => payload['id'],
        'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
        'updated_at' => Twilio.deserialize_iso8601_datetime(payload['updated_at']),
    }

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

Instance Method Details

#contentString

Returns The main content of the observation.

Returns:

  • (String)

    The main content of the observation.



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

def content
    @properties['content']
end

#contextObservationContext

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

Returns:



737
738
739
740
741
742
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 737

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

#conversation_idsArray<String>

Returns Array of conversation IDs associated with this observation.

Returns:

  • (Array<String>)

    Array of conversation IDs associated with this observation.



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

def conversation_ids
    @properties['conversation_ids']
end

#created_atTime

Returns The timestamp when the observation was created.

Returns:

  • (Time)

    The timestamp when the observation was created.



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

def created_at
    @properties['created_at']
end

#deleteBoolean

Delete the ObservationInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#fetchObservationInstance

Fetch the ObservationInstance

Returns:



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

def fetch

    context.fetch
end

#idString

Returns A unique identifier for the observation using Twilio Type ID (TTID) format.

Returns:

  • (String)

    A unique identifier for the observation using Twilio Type ID (TTID) format.



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

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#messageString

Returns Confirmation message for the operation.

Returns:

  • (String)

    Confirmation message for the operation.



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

def message
    @properties['message']
end

#occurred_atTime

Returns The timestamp when the observation originally occurred.

Returns:

  • (Time)

    The timestamp when the observation originally occurred.



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

def occurred_at
    @properties['occurred_at']
end

#patch(observation_base: nil) ⇒ ObservationInstance

Patch the ObservationInstance

Parameters:

  • observation_base (ObservationBase) (defaults to: nil)

Returns:



812
813
814
815
816
817
818
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 812

def patch(observation_base: nil
)

    context.patch(
        observation_base: observation_base, 
    )
end

#sourceString

Returns The source system that generated this observation. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters.

Returns:

  • (String)

    The source system that generated this observation. Allows letters, numbers, spaces, and URL-safe symbols. Excludes URL-unsafe characters like quotes, angle brackets, and control characters.



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

def source
    @properties['source']
end

#to_sObject

Provide a user friendly representation



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

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

#updated_atTime

Returns The timestamp when the observation was last updated.

Returns:

  • (Time)

    The timestamp when the observation was last updated.



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

def updated_at
    @properties['updated_at']
end