Class: SoftLayer::UserCustomer

Inherits:
ModelBase show all
Includes:
DynamicAttribute
Defined in:
lib/softlayer/UserCustomer.rb

Overview

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.

Instance Attribute Summary

Attributes inherited from ModelBase

#softlayer_client

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DynamicAttribute

included

Methods inherited from ModelBase

#[], #has_sl_property?, #initialize, #refresh_details, sl_attr, #to_ary

Constructor Details

This class inherits a constructor from SoftLayer::ModelBase

Class Method Details

.user_customer_with_username(username, client = nil) ⇒ Object

Retrieve the user customer associated with the specified username



139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# 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.(softlayer_client).service
   = .object_filter(user_customer_object_filter)
   = .object_mask(UserCustomer.default_object_mask)

  user_customer_data = .getUsers

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

Instance Method Details

#additional_emailsObject

Retrieve a portal user’s additional email addresses. These email addresses are contacted when updates are made to support tickets. :call-seq:

additional_emails(force_update=false)


92
93
94
95
96
97
98
99
100
101
102
# 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

#alternate_phoneObject

:attr_reader: alternate_phone A portal user’s secondary phone number.



21
# File 'lib/softlayer/UserCustomer.rb', line 21

sl_attr :alternate_phone,  'alternatePhone'

#api_authentication_keysObject

Retrieve a portal user’s API Authentication keys. There is a max limit of two API keys per user. :call-seq:

api_authentication_keys(force_update=false)


109
110
111
112
113
114
115
116
117
118
# 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

#createdObject

:attr_reader: created 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.



33
# File 'lib/softlayer/UserCustomer.rb', line 33

sl_attr :created,          'createDate'

#created_atObject

:attr_reader: created_at The date a portal user’s record was created.



26
# File 'lib/softlayer/UserCustomer.rb', line 26

sl_attr :created_at,          'createDate'

#display_nameObject

:attr_reader: display_name The portal user’s display name.



38
# File 'lib/softlayer/UserCustomer.rb', line 38

sl_attr :display_name,     'displayName'

#emailObject

:attr_reader: A portal user’s email address.



43
# File 'lib/softlayer/UserCustomer.rb', line 43

sl_attr :email

#external_bindingsObject

Retrieve the external authentication bindings that link an external identifier to a SoftLayer user. :call-seq:

external_bindings(force_update=false)


124
125
126
127
128
129
130
131
132
133
134
# 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

#first_nameObject

:attr_reader: first_name A portal user’s first name.



48
# File 'lib/softlayer/UserCustomer.rb', line 48

sl_attr :first_name,       'firstName'

#last_nameObject

:attr_reader: last_name A portal user’s last name.



53
# File 'lib/softlayer/UserCustomer.rb', line 53

sl_attr :last_name,        'lastName'

#modifiedObject

:attr_reader: modified 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.



65
# File 'lib/softlayer/UserCustomer.rb', line 65

sl_attr :modified,         'modifyDate'

#modified_atObject

:attr_reader: modified_at The date a portal user’s record was last modified.



58
# File 'lib/softlayer/UserCustomer.rb', line 58

sl_attr :modified_at,         'modifyDate'

#office_phoneObject

:attr_reader: office_phone A portal user’s office phone number.



70
# File 'lib/softlayer/UserCustomer.rb', line 70

sl_attr :office_phone,     'officePhone'

#password_expiresObject

:attr_reader: password_expires The expiration date for the user’s password.



75
# File 'lib/softlayer/UserCustomer.rb', line 75

sl_attr :password_expires, 'passwordExpireDate'

#serviceObject

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



162
163
164
# File 'lib/softlayer/UserCustomer.rb', line 162

def service
  softlayer_client[:User_Customer].object_with_id(self.id)
end

#status_changedObject

:attr_reader: status_changed The date a portal users record’s last status change.



80
# File 'lib/softlayer/UserCustomer.rb', line 80

sl_attr :status_changed,   'statusDate'

#usernameObject

:attr_reader: A portal user’s username.



85
# File 'lib/softlayer/UserCustomer.rb', line 85

sl_attr :username