class Twilio::REST::Conversations::V1::ServiceContext::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] chat_service_sid
The SID of the {Conversation
Service}[https://www.twilio.com/docs/conversations/api/service-resource] the User resource is associated with.
@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/service/user.rb 305 def initialize(version, payload, chat_service_sid: nil, sid: nil) 306 super(version) 307 308 # Marshaled Properties 309 @properties = { 310 'sid' => payload['sid'], 311 'account_sid' => payload['account_sid'], 312 'chat_service_sid' => payload['chat_service_sid'], 313 'role_sid' => payload['role_sid'], 314 'identity' => payload['identity'], 315 'friendly_name' => payload['friendly_name'], 316 'attributes' => payload['attributes'], 317 'is_online' => payload['is_online'], 318 'is_notifiable' => payload['is_notifiable'], 319 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 320 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 321 'url' => payload['url'], 322 'links' => payload['links'], 323 } 324 325 # Context 326 @instance_context = nil 327 @params = {'chat_service_sid' => chat_service_sid, 'sid' => sid || @properties['sid'], } 328 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 349 def account_sid 350 @properties['account_sid'] 351 end
@return [String] The JSON Object string that stores application-specific data
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 379 def attributes 380 @properties['attributes'] 381 end
@return [String] The SID of the Conversation Service that the resource is associated with
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 355 def chat_service_sid 356 @properties['chat_service_sid'] 357 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/service/user.rb 334 def context 335 unless @instance_context 336 @instance_context = UserContext.new(@version, @params['chat_service_sid'], @params['sid'], ) 337 end 338 @instance_context 339 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 397 def date_created 398 @properties['date_created'] 399 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 403 def date_updated 404 @properties['date_updated'] 405 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/service/user.rb 445 def delete(x_twilio_webhook_enabled: :unset) 446 context.delete(x_twilio_webhook_enabled: x_twilio_webhook_enabled, ) 447 end
Fetch the UserInstance
@return [UserInstance] Fetched UserInstance
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 452 def fetch 453 context.fetch 454 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 373 def friendly_name 374 @properties['friendly_name'] 375 end
@return [String] The string that identifies the resource's User
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 367 def identity 368 @properties['identity'] 369 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 472 def inspect 473 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 474 "<Twilio.Conversations.V1.UserInstance #{values}>" 475 end
@return [Boolean] Whether the User has a potentially valid Push Notification registration for this Conversations
Service
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 391 def is_notifiable 392 @properties['is_notifiable'] 393 end
@return [Boolean] Whether the User is actively connected to this Conversations
Service and online
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 385 def is_online 386 @properties['is_online'] 387 end
@return [String] The links
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 415 def links 416 @properties['links'] 417 end
@return [String] The SID of a service-level Role assigned to the user
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 361 def role_sid 362 @properties['role_sid'] 363 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 343 def sid 344 @properties['sid'] 345 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 465 def to_s 466 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 467 "<Twilio.Conversations.V1.UserInstance #{values}>" 468 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/service/user.rb 431 def update(friendly_name: :unset, attributes: :unset, role_sid: :unset, x_twilio_webhook_enabled: :unset) 432 context.update( 433 friendly_name: friendly_name, 434 attributes: attributes, 435 role_sid: role_sid, 436 x_twilio_webhook_enabled: x_twilio_webhook_enabled, 437 ) 438 end
@return [String] An absolute URL for this user.
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 409 def url 410 @properties['url'] 411 end
Access the user_conversations
@return [user_conversations] user_conversations
# File lib/twilio-ruby/rest/conversations/v1/service/user.rb 459 def user_conversations 460 context.user_conversations 461 end