Class: Twilio::REST::FlexApi::V2::FlexUserInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/flex_api/v2/flex_user.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, instance_sid: nil, flex_user_sid: nil) ⇒ FlexUserInstance

Initialize the FlexUserInstance

Parameters:

  • version (Version) —

    Version that contains the resource

  • payload (Hash) —

    payload that contains response from Twilio

  • account_sid (String) —

    The SID of the Account that created this FlexUser resource.

  • sid (String) —

    The SID of the Call resource to fetch.



282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 282

def initialize(version, payload , instance_sid: nil, flex_user_sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'instance_sid' => payload['instance_sid'],
        'user_sid' => payload['user_sid'],
        'flex_user_sid' => payload['flex_user_sid'],
        'worker_sid' => payload['worker_sid'],
        'workspace_sid' => payload['workspace_sid'],
        'flex_team_sid' => payload['flex_team_sid'],
        'username' => payload['username'],
        'email' => payload['email'],
        'locale' => payload['locale'],
        'roles' => payload['roles'],
        'created_date' => Twilio.deserialize_iso8601_datetime(payload['created_date']),
        'updated_date' => Twilio.deserialize_iso8601_datetime(payload['updated_date']),
        'version' => payload['version'] == nil ? payload['version'] : payload['version'].to_i,
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'instance_sid' => instance_sid  || @properties['instance_sid']  ,'flex_user_sid' => flex_user_sid  || @properties['flex_user_sid']  , }
end

Instance Method Details

#account_sid ⇒ String

Returns The unique SID of the account that created the resource.

Returns:

  • (String) —

    The unique SID of the account that created the resource.



323
324
325
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 323

def 
    @properties['account_sid']
end

#context ⇒ FlexUserContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



314
315
316
317
318
319
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 314

def context
    unless @instance_context
        @instance_context = FlexUserContext.new(@version , @params['instance_sid'], @params['flex_user_sid'])
    end
    @instance_context
end

#created_date ⇒ Time

Returns The date that this user was created, given in ISO 8601 format.

Returns:

  • (Time) —

    The date that this user was created, given in ISO 8601 format.



389
390
391
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 389

def created_date
    @properties['created_date']
end

#email ⇒ String

Returns Email of the User.

Returns:

  • (String) —

    Email of the User.



371
372
373
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 371

def email
    @properties['email']
end

#fetch ⇒ FlexUserInstance

Fetch the FlexUserInstance

Returns:



414
415
416
417
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 414

def fetch

    context.fetch
end

#flex_team_sid ⇒ String

Returns The unique SID identifier of the Flex Team.

Returns:

  • (String) —

    The unique SID identifier of the Flex Team.



359
360
361
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 359

def flex_team_sid
    @properties['flex_team_sid']
end

#flex_user_sid ⇒ String

Returns The unique SID identifier of the Flex User.

Returns:

  • (String) —

    The unique SID identifier of the Flex User.



341
342
343
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 341

def flex_user_sid
    @properties['flex_user_sid']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



447
448
449
450
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 447

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.FlexApi.V2.FlexUserInstance #{values}>"
end

#instance_sid ⇒ String

Returns The unique ID created by Twilio to identify a Flex instance.

Returns:

  • (String) —

    The unique ID created by Twilio to identify a Flex instance.



329
330
331
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 329

def instance_sid
    @properties['instance_sid']
end

#locale ⇒ String

Returns The locale preference of the user.

Returns:

  • (String) —

    The locale preference of the user.



377
378
379
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 377

def locale
    @properties['locale']
end

#roles ⇒ Array<String>

Returns The roles of the user.

Returns:

  • (Array<String>) —

    The roles of the user.



383
384
385
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 383

def roles
    @properties['roles']
end

#to_s ⇒ Object

Provide a user friendly representation



440
441
442
443
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 440

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.FlexApi.V2.FlexUserInstance #{values}>"
end

#update(email: :unset, user_sid: :unset, locale: :unset) ⇒ FlexUserInstance

Update the FlexUserInstance

Parameters:

  • email (String) (defaults to: :unset) —

    Email of the User.

  • user_sid (String) (defaults to: :unset) —

    The unique SID identifier of the Twilio Unified User.

  • locale (String) (defaults to: :unset) —

    The locale preference of the user.

Returns:



425
426
427
428
429
430
431
432
433
434
435
436
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 425

def update(
  email: :unset, 
  user_sid: :unset, 
  locale: :unset
)

    context.update(
        email: email, 
        user_sid: user_sid, 
        locale: locale, 
    )
end

#updated_date ⇒ Time

Returns The date that this user was updated, given in ISO 8601 format.

Returns:

  • (Time) —

    The date that this user was updated, given in ISO 8601 format.



395
396
397
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 395

def updated_date
    @properties['updated_date']
end

#url ⇒ String

Returns:

  • (String)


407
408
409
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 407

def url
    @properties['url']
end

#user_sid ⇒ String

Returns The unique SID identifier of the Twilio Unified User.

Returns:

  • (String) —

    The unique SID identifier of the Twilio Unified User.



335
336
337
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 335

def user_sid
    @properties['user_sid']
end

#username ⇒ String

Returns Username of the User.

Returns:

  • (String) —

    Username of the User.



365
366
367
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 365

def username
    @properties['username']
end

#version ⇒ String

Returns The current version of the user.

Returns:

  • (String) —

    The current version of the user.



401
402
403
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 401

def version
    @properties['version']
end

#worker_sid ⇒ String

Returns The unique SID identifier of the worker.

Returns:

  • (String) —

    The unique SID identifier of the worker.



347
348
349
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 347

def worker_sid
    @properties['worker_sid']
end

#workspace_sid ⇒ String

Returns The unique SID identifier of the workspace.

Returns:

  • (String) —

    The unique SID identifier of the workspace.



353
354
355
# File 'lib/twilio-ruby/rest/flex_api/v2/flex_user.rb', line 353

def workspace_sid
    @properties['workspace_sid']
end