Class: Twilio::REST::Preview::Understand::AssistantContext::DialogueInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, assistant_sid: nil, sid: nil) ⇒ DialogueInstance

Initialize the DialogueInstance

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

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 130

def initialize(version, payload , assistant_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'assistant_sid' => payload['assistant_sid'],
        'sid' => payload['sid'],
        'data' => payload['data'],
        'url' => payload['url'],
    }

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

Instance Method Details

#account_sidString

Returns The unique ID of the Account that created this Field.

Returns:

  • (String)

    The unique ID of the Account that created this Field.



160
161
162
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 160

def 
    @properties['account_sid']
end

#assistant_sidString

Returns The unique ID of the parent Assistant.

Returns:

  • (String)

    The unique ID of the parent Assistant.



166
167
168
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 166

def assistant_sid
    @properties['assistant_sid']
end

#contextDialogueContext

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

Returns:



151
152
153
154
155
156
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 151

def context
    unless @instance_context
        @instance_context = DialogueContext.new(@version , @params['assistant_sid'], @params['sid'])
    end
    @instance_context
end

#dataHash

Returns The dialogue memory object as json.

Returns:

  • (Hash)

    The dialogue memory object as json



178
179
180
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 178

def data
    @properties['data']
end

#fetchDialogueInstance

Fetch the DialogueInstance

Returns:



191
192
193
194
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 191

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



205
206
207
208
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 205

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

#sidString

Returns The unique ID of the Dialogue.

Returns:

  • (String)

    The unique ID of the Dialogue



172
173
174
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 172

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



198
199
200
201
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 198

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

#urlString

Returns:

  • (String)


184
185
186
# File 'lib/twilio-ruby/rest/preview/understand/assistant/dialogue.rb', line 184

def url
    @properties['url']
end