Class: Twilio::REST::Autopilot::V1::AssistantContext::DialogueContext

Inherits:
InstanceContext
  • 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, assistant_sid, sid) ⇒ DialogueContext

Initialize the DialogueContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assistant_sid (String)

    The SID of the [Assistant](www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to fetch.

  • sid (String)

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



81
82
83
84
85
86
87
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 81

def initialize(version, assistant_sid, sid)
  super(version)

  # Path Solution
  @solution = {assistant_sid: assistant_sid, sid: sid, }
  @uri = "/Assistants/#{@solution[:assistant_sid]}/Dialogues/#{@solution[:sid]}"
end

Instance Method Details

#fetchDialogueInstance

Fetch a DialogueInstance

Returns:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 92

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  DialogueInstance.new(
      @version,
      payload,
      assistant_sid: @solution[:assistant_sid],
      sid: @solution[:sid],
  )
end

#inspectObject

Provide a detailed, user friendly representation



118
119
120
121
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 118

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Autopilot.V1.DialogueContext #{context}>"
end

#to_sObject

Provide a user friendly representation



111
112
113
114
# File 'lib/twilio-ruby/rest/autopilot/v1/assistant/dialogue.rb', line 111

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Autopilot.V1.DialogueContext #{context}>"
end