class SoftLayer::UserCustomer

Each SoftLayer UserCustomer instance provides information relating to a single SoftLayer customer portal user

This class roughly corresponds to the entity SoftLayer_User_Customer in the API.

Attributes

alternate_phone[R]

A portal user's secondary phone number.

created[R]

The date a portal user's record was created. DEPRECATION WARNING: This attribute is deprecated in favor of #created_at and will be removed in the next major release.

created_at[R]

The date a portal user's record was created.

display_name[R]

The portal user's display name.

email[R]

A portal user's email address.

first_name[R]

A portal user's first name.

last_name[R]

A portal user's last name.

modified[R]

The date a portal user's record was last modified. DEPRECATION WARNING: This attribute is deprecated in favor of #modified_at and will be removed in the next major release.

modified_at[R]

The date a portal user's record was last modified.

office_phone[R]

A portal user's office phone number.

password_expires[R]

The expiration date for the user's password.

status_changed[R]

The date a portal users record's last status change.

username[R]

A portal user's username.

Public Class Methods

user_customer_with_username(username, client = nil) click to toggle source

Retrieve the user customer associated with the specified username

# File lib/softlayer/UserCustomer.rb, line 139
def self.user_customer_with_username(username, client = nil)
  softlayer_client = client || Client.default_client
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client
  raise "#{__method__} requires a user customer username but none was given" if !username || username.empty?

  user_customer_object_filter = ObjectFilter.new()

  user_customer_object_filter.modify { |filter| filter.accept('users.username').when_it is(username) }

  account_service = Account.account_for_client(softlayer_client).service
  account_service = account_service.object_filter(user_customer_object_filter)
  account_service = account_service.object_mask(UserCustomer.default_object_mask)

  user_customer_data = account_service.getUsers

  if user_customer_data.length == 1
    UserCustomer.new(softlayer_client, user_customer_data.first)
  end
end

Protected Class Methods

default_object_mask() click to toggle source
# File lib/softlayer/UserCustomer.rb, line 168
def self.default_object_mask
  {
    "mask(SoftLayer_User_Customer)" => [
                                        'alternatePhone',
                                        'createDate',
                                        'displayName',
                                        'email',
                                        'firstName',
                                        'id',
                                        'lastName',
                                        'modifyDate',
                                        'officePhone',
                                        'passwordExpireDate',
                                        'statusDate',
                                        'username'
                                       ]
  }.to_sl_object_mask
end

Public Instance Methods

additional_emails(force_update=false) click to toggle source

Retrieve a portal user's additional email addresses. These email addresses are contacted when updates are made to support tickets.

# File lib/softlayer/UserCustomer.rb, line 92
sl_dynamic_attr :additional_emails do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @additional_emails == nil
  end

  resource.to_update do
    additional_emails = self.service.getAdditionalEmails
    additional_emails.collect { |additional_email| additional_email['email'] }
  end
end
api_authentication_keys(force_update=false) click to toggle source

Retrieve a portal user's API Authentication keys. There is a max limit of two API keys per user.

# File lib/softlayer/UserCustomer.rb, line 109
sl_dynamic_attr :api_authentication_keys do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @api_authentication_keys == nil
  end

  resource.to_update do
    self.service.object_mask("mask[authenticationKey,ipAddressRestriction]").getApiAuthenticationKeys
  end
end
external_bindings(force_update=false) click to toggle source

Retrieve the external authentication bindings that link an external identifier to a SoftLayer user.

# File lib/softlayer/UserCustomer.rb, line 124
sl_dynamic_attr :external_bindings do |resource|
  resource.should_update? do
    #only retrieved once per instance
    @external_bindings == nil
  end

  resource.to_update do
    external_bindings = self.service.object_mask(UserCustomerExternalBinding.default_object_mask).getExternalBindings
    external_bindings.collect { |external_binding| UserCustomerExternalBinding.new(softlayer_client, external_binding) }
  end
end
service() click to toggle source

Returns the service for interacting with this user customer through the network API

# File lib/softlayer/UserCustomer.rb, line 162
def service
  softlayer_client[:User_Customer].object_with_id(self.id)
end