class Twilio::REST::Conversations::V1::UserInstance
Public Class Methods
Initialize the UserInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@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 [UserInstance] UserInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/conversations/v1/user.rb 276 def initialize(version, payload, sid: nil) 277 super(version) 278 279 # Marshaled Properties 280 @properties = { 281 'sid' => payload['sid'], 282 'account_sid' => payload['account_sid'], 283 'chat_service_sid' => payload['chat_service_sid'], 284 'role_sid' => payload['role_sid'], 285 'identity' => payload['identity'], 286 'friendly_name' => payload['friendly_name'], 287 'attributes' => payload['attributes'], 288 'is_online' => payload['is_online'], 289 'is_notifiable' => payload['is_notifiable'], 290 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 291 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 292 'url' => payload['url'], 293 'links' => payload['links'], 294 } 295 296 # Context 297 @instance_context = nil 298 @params = {'sid' => sid || @properties['sid'], } 299 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/conversations/v1/user.rb 320 def account_sid 321 @properties['account_sid'] 322 end
@return [String] The JSON Object string that stores application-specific data
# File lib/twilio-ruby/rest/conversations/v1/user.rb 350 def attributes 351 @properties['attributes'] 352 end
@return [String] The SID of the Conversation Service that the resource is associated with
# File lib/twilio-ruby/rest/conversations/v1/user.rb 326 def chat_service_sid 327 @properties['chat_service_sid'] 328 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [UserContext] UserContext
for this UserInstance
# File lib/twilio-ruby/rest/conversations/v1/user.rb 305 def context 306 unless @instance_context 307 @instance_context = UserContext.new(@version, @params['sid'], ) 308 end 309 @instance_context 310 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/conversations/v1/user.rb 368 def date_created 369 @properties['date_created'] 370 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/conversations/v1/user.rb 374 def date_updated 375 @properties['date_updated'] 376 end
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 416 def delete(x_twilio_webhook_enabled: :unset) 417 context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) 418 end
Fetch the UserInstance
@return [UserInstance] Fetched UserInstance
# File lib/twilio-ruby/rest/conversations/v1/user.rb 423 def fetch 424 context.fetch 425 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/conversations/v1/user.rb 344 def friendly_name 345 @properties['friendly_name'] 346 end
@return [String] The string that identifies the resource's User
# File lib/twilio-ruby/rest/conversations/v1/user.rb 338 def identity 339 @properties['identity'] 340 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/user.rb 443 def inspect 444 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 445 "<Twilio.Conversations.V1.UserInstance #{values}>" 446 end
@return [Boolean] Whether the User has a potentially valid Push Notification registration for this Conversations
Service
# File lib/twilio-ruby/rest/conversations/v1/user.rb 362 def is_notifiable 363 @properties['is_notifiable'] 364 end
@return [Boolean] Whether the User is actively connected to this Conversations
Service and online
# File lib/twilio-ruby/rest/conversations/v1/user.rb 356 def is_online 357 @properties['is_online'] 358 end
@return [String] The links
# File lib/twilio-ruby/rest/conversations/v1/user.rb 386 def links 387 @properties['links'] 388 end
@return [String] The SID of a service-level Role assigned to the user
# File lib/twilio-ruby/rest/conversations/v1/user.rb 332 def role_sid 333 @properties['role_sid'] 334 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/conversations/v1/user.rb 314 def sid 315 @properties['sid'] 316 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/user.rb 436 def to_s 437 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 438 "<Twilio.Conversations.V1.UserInstance #{values}>" 439 end
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 402 def update(friendly_name: :unset, attributes: :unset, role_sid: :unset, x_twilio_webhook_enabled: :unset) 403 context.update( 404 friendly_name: friendly_name, 405 attributes: attributes, 406 role_sid: role_sid, 407 x_twilio_webhook_enabled: x_twilio_webhook_enabled, 408 ) 409 end
@return [String] An absolute URL for this user.
# File lib/twilio-ruby/rest/conversations/v1/user.rb 380 def url 381 @properties['url'] 382 end
Access the user_conversations
@return [user_conversations] user_conversations
# File lib/twilio-ruby/rest/conversations/v1/user.rb 430 def user_conversations 431 context.user_conversations 432 end