Class: Twilio::REST::FrontlineApi::V1::UserInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::FrontlineApi::V1::UserInstance
- Defined in:
- lib/twilio-ruby/rest/frontline_api/v1/user.rb
Instance Method Summary collapse
-
#avatar ⇒ String
The avatar URL which will be shown in Frontline application.
-
#context ⇒ UserContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#fetch ⇒ UserInstance
Fetch the UserInstance.
-
#friendly_name ⇒ String
The string that you assigned to describe the User.
-
#identity ⇒ String
The application-defined string that uniquely identifies the resource’s User.
-
#initialize(version, payload, sid: nil) ⇒ UserInstance
constructor
Initialize the UserInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#is_available ⇒ Boolean
Whether the User is available for new conversations.
-
#sid ⇒ String
The unique string that we created to identify the User resource.
- #state ⇒ StateType
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset) ⇒ UserInstance
Update the UserInstance.
-
#url ⇒ String
An absolute API resource URL for this user.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ UserInstance
Initialize the UserInstance
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 342 def initialize(version, payload , sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'identity' => payload['identity'], 'friendly_name' => payload['friendly_name'], 'avatar' => payload['avatar'], 'state' => payload['state'], 'is_available' => payload['is_available'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#avatar ⇒ String
Returns The avatar URL which will be shown in Frontline application.
393 394 395 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 393 def avatar @properties['avatar'] end |
#context ⇒ UserContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
366 367 368 369 370 371 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 366 def context unless @instance_context @instance_context = UserContext.new(@version , @params['sid']) end @instance_context end |
#fetch ⇒ UserInstance
Fetch the UserInstance
418 419 420 421 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 418 def fetch context.fetch end |
#friendly_name ⇒ String
Returns The string that you assigned to describe the User.
387 388 389 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 387 def friendly_name @properties['friendly_name'] end |
#identity ⇒ String
Returns The application-defined string that uniquely identifies the resource’s User. This value is often a username or an email address, and is case-sensitive.
381 382 383 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 381 def identity @properties['identity'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
454 455 456 457 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 454 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.FrontlineApi.V1.UserInstance #{values}>" end |
#is_available ⇒ Boolean
Returns Whether the User is available for new conversations. Defaults to false for new users.
405 406 407 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 405 def is_available @properties['is_available'] end |
#sid ⇒ String
Returns The unique string that we created to identify the User resource.
375 376 377 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 375 def sid @properties['sid'] end |
#state ⇒ StateType
399 400 401 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 399 def state @properties['state'] end |
#to_s ⇒ Object
Provide a user friendly representation
447 448 449 450 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 447 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.FrontlineApi.V1.UserInstance #{values}>" end |
#update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset) ⇒ UserInstance
Update the UserInstance
430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 430 def update( friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset ) context.update( friendly_name: friendly_name, avatar: avatar, state: state, is_available: is_available, ) end |
#url ⇒ String
Returns An absolute API resource URL for this user.
411 412 413 |
# File 'lib/twilio-ruby/rest/frontline_api/v1/user.rb', line 411 def url @properties['url'] end |