Class: Twilio::REST::Autopilot::V1::AssistantContext::DialogueInstance

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected]

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

  • assistant_sid (String) (defaults to: nil)

    The SID of the Assistant that is the parent of the resource.

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the Dialogue resource to fetch.


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

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, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


161
162
163
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 161

def 
  @properties['account_sid']
end

#assistant_sidString

Returns The SID of the Assistant that is the parent of the resource.

Returns:

  • (String)

    The SID of the Assistant that is the parent of the resource


167
168
169
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 167

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:


152
153
154
155
156
157
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 152

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

#dataHash

Returns The JSON string that describes the dialogue session object.

Returns:

  • (Hash)

    The JSON string that describes the dialogue session object


179
180
181
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 179

def data
  @properties['data']
end

#fetchDialogueInstance

Fetch the DialogueInstance

Returns:


192
193
194
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 192

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


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

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

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


173
174
175
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 173

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


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

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

#urlString

Returns The absolute URL of the Dialogue resource.

Returns:

  • (String)

    The absolute URL of the Dialogue resource


185
186
187
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 185

def url
  @properties['url']
end