Class: Twilio::REST::Assistants::V1::SessionContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/assistants/v1/session.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, id) ⇒ SessionContext

Initialize the SessionContext

Parameters:

  • version (Version)

    Version that contains the resource

  • id (String)


136
137
138
139
140
141
142
143
144
145
# File 'lib/twilio-ruby/rest/assistants/v1/session.rb', line 136

def initialize(version, id)
    super(version)

    # Path Solution
    @solution = { id: id,  }
    @uri = "/Sessions/#{@solution[:id]}"

    # Dependents
    @messages = nil
end

Instance Method Details

#fetchSessionInstance

Fetch the SessionInstance

Returns:



149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/twilio-ruby/rest/assistants/v1/session.rb', line 149

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    SessionInstance.new(
        @version,
        payload,
        id: @solution[:id],
    )
end

#inspectObject

Provide a detailed, user friendly representation



186
187
188
189
# File 'lib/twilio-ruby/rest/assistants/v1/session.rb', line 186

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

#messagesMessageList, MessageContext

Access the messages

Returns:

  • (MessageList)
  • (MessageContext)


169
170
171
172
173
174
175
# File 'lib/twilio-ruby/rest/assistants/v1/session.rb', line 169

def messages
  unless @messages
    @messages = MessageList.new(
            @version, )
  end
  @messages
end

#to_sObject

Provide a user friendly representation



179
180
181
182
# File 'lib/twilio-ruby/rest/assistants/v1/session.rb', line 179

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