class Twilio::REST::Conversations::V1::UserContext

Public Class Methods

new(version, sid) click to toggle source

Initialize the UserContext @param [Version] version Version that contains the resource @param [String] sid The SID of the User resource to fetch. This value can be

either the `sid` or the `identity` of the User resource to fetch.

@return [UserContext] UserContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/conversations/v1/user.rb
179 def initialize(version, sid)
180   super(version)
181 
182   # Path Solution
183   @solution = {sid: sid, }
184   @uri = "/Users/#{@solution[:sid]}"
185 
186   # Dependents
187   @user_conversations = nil
188 end

Public Instance Methods

delete(x_twilio_webhook_enabled: :unset) click to toggle source

Delete the UserInstance @param [user.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/conversations/v1/user.rb
220 def delete(x_twilio_webhook_enabled: :unset)
221   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
222 
223    @version.delete('DELETE', @uri, headers: headers)
224 end
fetch() click to toggle source

Fetch the UserInstance @return [UserInstance] Fetched UserInstance

    # File lib/twilio-ruby/rest/conversations/v1/user.rb
229 def fetch
230   payload = @version.fetch('GET', @uri)
231 
232   UserInstance.new(@version, payload, sid: @solution[:sid], )
233 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/user.rb
262 def inspect
263   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
264   "#<Twilio.Conversations.V1.UserContext #{context}>"
265 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/conversations/v1/user.rb
255 def to_s
256   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
257   "#<Twilio.Conversations.V1.UserContext #{context}>"
258 end
update(friendly_name: :unset, attributes: :unset, role_sid: :unset, x_twilio_webhook_enabled: :unset) click to toggle source

Update the UserInstance @param [String] friendly_name The string that you assigned to describe the

resource.

@param [String] attributes The JSON Object string that stores

application-specific data. If attributes have not been set, `{}` is returned.

@param [String] role_sid The SID of a service-level

{Role}[https://www.twilio.com/docs/conversations/api/role-resource] to assign to
the user.

@param [user.WebhookEnabledType] x_twilio_webhook_enabled The

X-Twilio-Webhook-Enabled HTTP request header

@return [UserInstance] Updated UserInstance

    # File lib/twilio-ruby/rest/conversations/v1/user.rb
202 def update(friendly_name: :unset, attributes: :unset, role_sid: :unset, x_twilio_webhook_enabled: :unset)
203   data = Twilio::Values.of({
204       'FriendlyName' => friendly_name,
205       'Attributes' => attributes,
206       'RoleSid' => role_sid,
207   })
208   headers = Twilio::Values.of({'X-Twilio-Webhook-Enabled' => x_twilio_webhook_enabled, })
209 
210   payload = @version.update('POST', @uri, data: data, headers: headers)
211 
212   UserInstance.new(@version, payload, sid: @solution[:sid], )
213 end
user_conversations(conversation_sid=:unset) click to toggle source

Access the user_conversations @return [UserConversationList] @return [UserConversationContext] if conversation_sid was passed.

    # File lib/twilio-ruby/rest/conversations/v1/user.rb
239 def user_conversations(conversation_sid=:unset)
240   raise ArgumentError, 'conversation_sid cannot be nil' if conversation_sid.nil?
241 
242   if conversation_sid != :unset
243     return UserConversationContext.new(@version, @solution[:sid], conversation_sid, )
244   end
245 
246   unless @user_conversations
247     @user_conversations = UserConversationList.new(@version, user_sid: @solution[:sid], )
248   end
249 
250   @user_conversations
251 end