class Twilio::REST::Chat::V2::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/chat/rest/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/chat/v2/service/user.rb 310 def initialize(version, payload, service_sid: nil, sid: nil) 311 super(version) 312 313 # Marshaled Properties 314 @properties = { 315 'sid' => payload['sid'], 316 'account_sid' => payload['account_sid'], 317 'service_sid' => payload['service_sid'], 318 'attributes' => payload['attributes'], 319 'friendly_name' => payload['friendly_name'], 320 'role_sid' => payload['role_sid'], 321 'identity' => payload['identity'], 322 'is_online' => payload['is_online'], 323 'is_notifiable' => payload['is_notifiable'], 324 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 325 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 326 'joined_channels_count' => payload['joined_channels_count'].to_i, 327 'links' => payload['links'], 328 'url' => payload['url'], 329 } 330 331 # Context 332 @instance_context = nil 333 @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], } 334 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 355 def account_sid 356 @properties['account_sid'] 357 end
@return [String] The JSON string that stores application-specific data
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 367 def attributes 368 @properties['attributes'] 369 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/v2/service/user.rb 340 def context 341 unless @instance_context 342 @instance_context = UserContext.new(@version, @params['service_sid'], @params['sid'], ) 343 end 344 @instance_context 345 end
@return [Time] The ISO 8601 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 403 def date_created 404 @properties['date_created'] 405 end
@return [Time] The ISO 8601 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 409 def date_updated 410 @properties['date_updated'] 411 end
Delete the UserInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 441 def delete 442 context.delete 443 end
Fetch the UserInstance
@return [UserInstance] Fetched UserInstance
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 434 def fetch 435 context.fetch 436 end
@return [String] The string that you assigned to describe the resource
# File lib/twilio-ruby/rest/chat/v2/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/chat/v2/service/user.rb 385 def identity 386 @properties['identity'] 387 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 489 def inspect 490 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 491 "<Twilio.Chat.V2.UserInstance #{values}>" 492 end
@return [Boolean] Whether the User has a potentially valid Push Notification registration for the Service instance
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 397 def is_notifiable 398 @properties['is_notifiable'] 399 end
@return [Boolean] Whether the User is actively connected to the Service instance and online
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 391 def is_online 392 @properties['is_online'] 393 end
@return [String] The number of Channels the User is a Member of
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 415 def joined_channels_count 416 @properties['joined_channels_count'] 417 end
@return [String] The absolute URLs of the Channel and Binding resources related to the user
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 421 def links 422 @properties['links'] 423 end
@return [String] The SID of the Role assigned to the user
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 379 def role_sid 380 @properties['role_sid'] 381 end
@return [String] The SID of the Service that the resource is associated with
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 361 def service_sid 362 @properties['service_sid'] 363 end
@return [String] The unique string that identifies the resource
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 349 def sid 350 @properties['sid'] 351 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 482 def to_s 483 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 484 "<Twilio.Chat.V2.UserInstance #{values}>" 485 end
Update the UserInstance
@param [String] role_sid
The SID of the
{Role}[https://www.twilio.com/docs/chat/rest/role-resource] to assign to the 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.
@param [user.WebhookEnabledType] x_twilio_webhook_enabled The
X-Twilio-Webhook-Enabled HTTP request header
@return [UserInstance] Updated UserInstance
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 457 def update(role_sid: :unset, attributes: :unset, friendly_name: :unset, x_twilio_webhook_enabled: :unset) 458 context.update( 459 role_sid: role_sid, 460 attributes: attributes, 461 friendly_name: friendly_name, 462 x_twilio_webhook_enabled: x_twilio_webhook_enabled, 463 ) 464 end
@return [String] The absolute URL of the User resource
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 427 def url 428 @properties['url'] 429 end
Access the user_bindings
@return [user_bindings] user_bindings
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 476 def user_bindings 477 context.user_bindings 478 end
Access the user_channels
@return [user_channels] user_channels
# File lib/twilio-ruby/rest/chat/v2/service/user.rb 469 def user_channels 470 context.user_channels 471 end