class Twilio::REST::Chat::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] service_sid
The SID of the
{Service}[https://www.twilio.com/docs/api/chat/rest/services] the resource is associated with.
@param [String] sid The Twilio-provided string that uniquely identifies the User
resource to fetch.
@return [UserInstance] UserInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 274 def initialize(version, payload, service_sid: nil, sid: nil) 275 super(version) 276 277 # Marshaled Properties 278 @properties = { 279 'sid' => payload['sid'], 280 'account_sid' => payload['account_sid'], 281 'service_sid' => payload['service_sid'], 282 'attributes' => payload['attributes'], 283 'friendly_name' => payload['friendly_name'], 284 'role_sid' => payload['role_sid'], 285 'identity' => payload['identity'], 286 'is_online' => payload['is_online'], 287 'is_notifiable' => payload['is_notifiable'], 288 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 289 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 290 'joined_channels_count' => payload['joined_channels_count'].to_i, 291 'links' => payload['links'], 292 'url' => payload['url'], 293 } 294 295 # Context 296 @instance_context = nil 297 @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], } 298 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 319 def account_sid 320 @properties['account_sid'] 321 end
@return [String] The JSON string that stores application-specific data
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 331 def attributes 332 @properties['attributes'] 333 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/chat/v1/service/user.rb 304 def context 305 unless @instance_context 306 @instance_context = UserContext.new(@version, @params['service_sid'], @params['sid'], ) 307 end 308 @instance_context 309 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 367 def date_created 368 @properties['date_created'] 369 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 373 def date_updated 374 @properties['date_updated'] 375 end
Delete the UserInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 405 def delete 406 context.delete 407 end
Fetch the UserInstance
@return [UserInstance] Fetched UserInstance
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 398 def fetch 399 context.fetch 400 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 337 def friendly_name 338 @properties['friendly_name'] 339 end
@return [String] The string that identifies the resource's User
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 349 def identity 350 @properties['identity'] 351 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 438 def inspect 439 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 440 "<Twilio.Chat.V1.UserInstance #{values}>" 441 end
@return [Boolean] Whether the User has a potentially valid Push Notification registration for the Service instance
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 361 def is_notifiable 362 @properties['is_notifiable'] 363 end
@return [Boolean] Whether the User is actively connected to the Service instance and online
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 355 def is_online 356 @properties['is_online'] 357 end
@return [String] The number of Channels this User is a Member of
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 379 def joined_channels_count 380 @properties['joined_channels_count'] 381 end
@return [String] The absolute URLs of the Channel and Binding resources related to the user
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 385 def links 386 @properties['links'] 387 end
@return [String] The SID of the assigned to the user
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 343 def role_sid 344 @properties['role_sid'] 345 end
@return [String] The SID of the Service that the resource is associated with
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 325 def service_sid 326 @properties['service_sid'] 327 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 313 def sid 314 @properties['sid'] 315 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 431 def to_s 432 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 433 "<Twilio.Chat.V1.UserInstance #{values}>" 434 end
Update the UserInstance
@param [String] role_sid
The SID of the
{Role}[https://www.twilio.com/docs/api/chat/rest/roles] assigned to this user.
@param [String] attributes A valid JSON string that contains
application-specific data.
@param [String] friendly_name
A descriptive string that you create to describe
the resource. It is often used for display purposes.
@return [UserInstance] Updated UserInstance
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 418 def update(role_sid: :unset, attributes: :unset, friendly_name: :unset) 419 context.update(role_sid: role_sid, attributes: attributes, friendly_name: friendly_name, ) 420 end
@return [String] The absolute URL of the User resource
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 391 def url 392 @properties['url'] 393 end
Access the user_channels
@return [user_channels] user_channels
# File lib/twilio-ruby/rest/chat/v1/service/user.rb 425 def user_channels 426 context.user_channels 427 end