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.



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

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

#content ⇒ String

Returns The main content of the observation.

Returns:

  • (String) —

    The main content of the observation.



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

def content
    @properties['content']
end

#context ⇒ ObservationContext

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

Returns:



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

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

#conversation_ids ⇒ Array<String>

Returns Array of conversation IDs associated with this observation.

Returns:

  • (Array<String>) —

    Array of conversation IDs associated with this observation.



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

def conversation_ids
    @properties['conversation_ids']
end

#created_at ⇒ Time

Returns The timestamp when the observation was created.

Returns:

  • (Time) —

    The timestamp when the observation was created.



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

def created_at
    @properties['created_at']
end

#delete ⇒ Boolean

Delete the ObservationInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#fetch ⇒ ObservationInstance

Fetch the ObservationInstance

Returns:



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

def fetch

    context.fetch
end

#id ⇒ String

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.



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

def id
    @properties['id']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



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

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

#message ⇒ String

Returns Confirmation message for the operation.

Returns:

  • (String) —

    Confirmation message for the operation.



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

def message
    @properties['message']
end

#occurred_at ⇒ Time

Returns The timestamp when the observation originally occurred.

Returns:

  • (Time) —

    The timestamp when the observation originally occurred.



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

def occurred_at
    @properties['occurred_at']
end

#patch(observation_base: nil) ⇒ ObservationInstance

Patch the ObservationInstance

Parameters:

  • observation_base (ObservationBase) (defaults to: nil)

Returns:



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

def patch(observation_base: nil
)

    context.patch(
        observation_base: observation_base, 
    )
end

#source ⇒ String

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.



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

def source
    @properties['source']
end

#to_s ⇒ Object

Provide a user friendly representation



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

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

#updated_at ⇒ Time

Returns The timestamp when the observation was last updated.

Returns:

  • (Time) —

    The timestamp when the observation was last updated.



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

def updated_at
    @properties['updated_at']
end