Class: Twilio::REST::PreviewIam::Versionless::OrganizationContext::UserInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, organization_sid: nil, id: nil) ⇒ UserInstance

Initialize the UserInstance

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 User resource.

  • sid (String)

    The SID of the Call resource to fetch.



344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 344

def initialize(version, payload , organization_sid: nil, id: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'id' => payload['id'],
        'external_id' => payload['external_id'],
        'user_name' => payload['user_name'],
        'display_name' => payload['display_name'],
        'name' => payload['name'],
        'emails' => payload['emails'],
        'active' => payload['active'],
        'locale' => payload['locale'],
        'timezone' => payload['timezone'],
        'schemas' => payload['schemas'],
        'meta' => payload['meta'],
        'detail' => payload['detail'],
        'scim_type' => payload['scim_type'],
        'status' => payload['status'],
        'code' => payload['code'],
        'more_info' => payload['more_info'],
    }

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

Instance Method Details

#activeBoolean

Returns Indicates whether the user is active.

Returns:

  • (Boolean)

    Indicates whether the user is active



421
422
423
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 421

def active
    @properties['active']
end

#codeString

Returns Twilio-specific error code.

Returns:

  • (String)

    Twilio-specific error code



469
470
471
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 469

def code
    @properties['code']
end

#contextUserContext

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

Returns:



376
377
378
379
380
381
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 376

def context
    unless @instance_context
        @instance_context = UserContext.new(@version , @params['organization_sid'], @params['id'])
    end
    @instance_context
end

#deleteBoolean

Delete the UserInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



482
483
484
485
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 482

def delete

    context.delete
end

#detailString

Returns A human-readable description of the error.

Returns:

  • (String)

    A human-readable description of the error



451
452
453
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 451

def detail
    @properties['detail']
end

#display_nameString

Returns User friendly display name.

Returns:

  • (String)

    User friendly display name



403
404
405
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 403

def display_name
    @properties['display_name']
end

#emailsArray<UserList.ScimEmailAddress>

Returns Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username.

Returns:

  • (Array<UserList.ScimEmailAddress>)

    Email address list of the user. Primary email must be defined if there are more than 1 email. Primary email must match the username.



415
416
417
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 415

def emails
    @properties['emails']
end

#external_idString

Returns External unique resource id defined by provisioning client.

Returns:

  • (String)

    External unique resource id defined by provisioning client



391
392
393
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 391

def external_id
    @properties['external_id']
end

#fetchUserInstance

Fetch the UserInstance

Returns:



490
491
492
493
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 490

def fetch

    context.fetch
end

#idString

Returns Unique Twilio user sid.

Returns:

  • (String)

    Unique Twilio user sid



385
386
387
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 385

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



518
519
520
521
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 518

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

#localeString

Returns User’s locale.

Returns:

  • (String)

    User’s locale



427
428
429
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 427

def locale
    @properties['locale']
end

#metaUserList.ScimMeta

Returns:



445
446
447
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 445

def meta
    @properties['meta']
end

#more_infoString

Returns Link to Error Code References.

Returns:

  • (String)

    Link to Error Code References



475
476
477
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 475

def more_info
    @properties['more_info']
end

#nameUserList.ScimName

Returns:



409
410
411
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 409

def name
    @properties['name']
end

#schemasArray<String>

Returns An array of URIs that indicate the schemas supported for this user resource.

Returns:

  • (Array<String>)

    An array of URIs that indicate the schemas supported for this user resource



439
440
441
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 439

def schemas
    @properties['schemas']
end

#scim_typeString

Returns A scimType error code as defined in RFC7644.

Returns:

  • (String)

    A scimType error code as defined in RFC7644



457
458
459
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 457

def scim_type
    @properties['scim_type']
end

#statusString

Returns Http status code.

Returns:

  • (String)

    Http status code



463
464
465
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 463

def status
    @properties['status']
end

#timezoneString

Returns User’s time zone.

Returns:

  • (String)

    User’s time zone



433
434
435
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 433

def timezone
    @properties['timezone']
end

#to_sObject

Provide a user friendly representation



511
512
513
514
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 511

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

#update(if_match: :unset, scim_user: nil) ⇒ UserInstance

Update the UserInstance

Parameters:

  • if_match (String) (defaults to: :unset)
  • scim_user (ScimUser) (defaults to: nil)

Returns:



500
501
502
503
504
505
506
507
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 500

def update(
    if_match: :unset,scim_user: nil
)

    context.update(
        if_match: if_match, 
    )
end

#user_nameString

Returns Unique username, MUST be same as primary email address.

Returns:

  • (String)

    Unique username, MUST be same as primary email address



397
398
399
# File 'lib/twilio-ruby/rest/preview_iam/versionless/organization/user.rb', line 397

def user_name
    @properties['user_name']
end