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.



659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 659

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.



700
701
702
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 700

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:



685
686
687
688
689
690
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 685

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.



718
719
720
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 718

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.



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

def created_at
    @properties['created_at']
end

#deleteBoolean

Delete the ObservationInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#fetchObservationInstance

Fetch the ObservationInstance

Returns:



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

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.



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

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



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

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.



694
695
696
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 694

def message
    @properties['message']
end

#occurred_atTime

Returns The timestamp when the observation originally occurred.

Returns:

  • (Time)

    The timestamp when the observation originally occurred.



706
707
708
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 706

def occurred_at
    @properties['occurred_at']
end

#patch(observation_core: nil) ⇒ ObservationInstance

Patch the ObservationInstance

Parameters:

  • observation_core (ObservationCore) (defaults to: nil)

Returns:



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

def patch(observation_core: nil
)

    context.patch(
        observation_core: observation_core, 
    )
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.



712
713
714
# File 'lib/twilio-ruby/rest/memory/v1/observation.rb', line 712

def source
    @properties['source']
end

#to_sObject

Provide a user friendly representation



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

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.



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

def updated_at
    @properties['updated_at']
end