Class: OneLogin::Api::Models::User

Inherits:
Object
  • Object
show all
Defined in:
lib/onelogin/api/models/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ User

Returns a new instance of User.


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/onelogin/api/models/user.rb', line 13

def initialize(data)
  @id = data['id']
  @external_id = data['external_id']
  @email = data['email'].to_s
  @username = data['username'].to_s
  @firstname = data['firstname'].to_s
  @lastname = data['lastname'].to_s
  @distinguished_name = data['distinguished_name'].to_s
  @phone = data['phone'].to_s
  @company = data['company'].to_s
  @department = data['department'].to_s
  @title = data['title'].to_s
  @status = data['status']
  @state = data['state']
  @member_of = data['member_of'].to_s
  @samaccountname = data['samaccountname'].to_s
  @userprincipalname = data['userprincipalname'].to_s
  @group_id = data['group_id']? data['group_id'].to_i : nil
  @role_ids = data['role_id']? data['role_id'] : []
  @custom_attributes = data['custom_attributes'] ? data['custom_attributes'] : []
  @openid_name = data['openid_name'].to_s
  @locale_code = data['locale_code'].to_s
  @comment = data['comment'].to_s
  @directory_id = data['directory_id']
  @manager_ad_id = data['manager_ad_id']
  @trusted_idp_id = data['trusted_idp_id']
  @manager_user_id = data['manager_user_id']
  @activated_at = data['activated_at']? Time.iso8601(data['activated_at']) : nil
  @created_at = data['created_at']? Time.iso8601(data['created_at']) : nil
  @updated_at = data['updated_at']? Time.iso8601(data['updated_at']) : nil
  @password_changed_at = data['password_changed_at']? Time.iso8601(data['password_changed_at']) : nil
  @invitation_sent_at = data['invitation_sent_at']? Time.iso8601(data['invitation_sent_at']) : nil
  @invalid_login_attempts = data['invalid_login_attempts']
  @last_login = data['last_login']? Time.iso8601(data['last_login']) : nil
  @locked_until = data['locked_until']? Time.iso8601(data['locked_until']) : nil
end

Instance Attribute Details

#activated_atObject

Returns the value of attribute activated_at.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def activated_at
  @activated_at
end

#commentObject

Returns the value of attribute comment.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def comment
  @comment
end

#companyObject

Returns the value of attribute company.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def company
  @company
end

#created_atObject

Returns the value of attribute created_at.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def created_at
  @created_at
end

#custom_attributesObject

Returns the value of attribute custom_attributes.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def custom_attributes
  @custom_attributes
end

#departmentObject

Returns the value of attribute department.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def department
  @department
end

#directory_idObject

Returns the value of attribute directory_id.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def directory_id
  @directory_id
end

#distinguished_nameObject

Returns the value of attribute distinguished_name.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def distinguished_name
  @distinguished_name
end

#emailObject

Returns the value of attribute email.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def email
  @email
end

#external_idObject

Returns the value of attribute external_id.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def external_id
  @external_id
end

#firstnameObject

Returns the value of attribute firstname.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def firstname
  @firstname
end

#group_idObject

Returns the value of attribute group_id.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def group_id
  @group_id
end

#idObject

Returns the value of attribute id.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def id
  @id
end

#invalid_login_attemptsObject

Returns the value of attribute invalid_login_attempts.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def 
  @invalid_login_attempts
end

#invitation_sent_atObject

Returns the value of attribute invitation_sent_at.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def invitation_sent_at
  @invitation_sent_at
end

#last_loginObject

Returns the value of attribute last_login.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def 
  @last_login
end

#lastnameObject

Returns the value of attribute lastname.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def lastname
  @lastname
end

#locale_codeObject

Returns the value of attribute locale_code.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def locale_code
  @locale_code
end

#locked_untilObject

Returns the value of attribute locked_until.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def locked_until
  @locked_until
end

#manager_ad_idObject

Returns the value of attribute manager_ad_id.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def manager_ad_id
  @manager_ad_id
end

#manager_user_idObject

Returns the value of attribute manager_user_id.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def manager_user_id
  @manager_user_id
end

#member_ofObject

Returns the value of attribute member_of.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def member_of
  @member_of
end

#openid_nameObject

Returns the value of attribute openid_name.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def openid_name
  @openid_name
end

#password_changed_atObject

Returns the value of attribute password_changed_at.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def password_changed_at
  @password_changed_at
end

#phoneObject

Returns the value of attribute phone.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def phone
  @phone
end

#role_idsObject

Returns the value of attribute role_ids.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def role_ids
  @role_ids
end

#samaccountnameObject

Returns the value of attribute samaccountname.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def samaccountname
  @samaccountname
end

#stateObject

Returns the value of attribute state.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def state
  @state
end

#statusObject

Returns the value of attribute status.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def status
  @status
end

#titleObject

Returns the value of attribute title.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def title
  @title
end

#trusted_idp_idObject

Returns the value of attribute trusted_idp_id.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def trusted_idp_id
  @trusted_idp_id
end

#updated_atObject

Returns the value of attribute updated_at.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def updated_at
  @updated_at
end

#usernameObject

Returns the value of attribute username.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def username
  @username
end

#userprincipalnameObject

Returns the value of attribute userprincipalname.


7
8
9
# File 'lib/onelogin/api/models/user.rb', line 7

def userprincipalname
  @userprincipalname
end

Instance Method Details

#get_custom_attributesObject


101
102
103
# File 'lib/onelogin/api/models/user.rb', line 101

def get_custom_attributes
  @custom_attributes
end

#get_group_idObject


54
55
56
# File 'lib/onelogin/api/models/user.rb', line 54

def get_group_id
  @group_id
end

#get_role_idsObject


50
51
52
# File 'lib/onelogin/api/models/user.rb', line 50

def get_role_ids
  @role_ids
end

#get_user_dataObject


58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/onelogin/api/models/user.rb', line 58

def get_user_data
  user_data = UserData.new
  user_data.id = @id
  user_data.external_id = @external_id
  user_data.email = @email
  user_data.username = @username
  user_data.firstname = @firstname
  user_data.lastname = @lastname
  user_data.distinguished_name = @distinguished_name
  user_data.phone = @phone
  user_data.company = @company
  user_data.department = @department
  user_data.title = @title
  user_data.status = @status
  user_data.state = @state
  user_data.member_of = @member_of
  user_data.samaccountname = @samaccountname
  user_data.userprincipalname = @userprincipalname
  user_data.openid_name = @openid_name
  user_data.locale_code = @locale_code
  user_data.directory_id = @directory_id
  user_data.manager_ad_id = @manager_ad_id
  user_data.trusted_idp_id = @trusted_idp_id
  user_data.manager_user_id = @manager_user_id
  return user_data
end

#get_user_metadataObject


85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/onelogin/api/models/user.rb', line 85

def 
   = UserMetadata.new
  .id = @id
  .activated_at = @activated_at
  .created_at = @created_at
  .updated_at = @updated_at
  .password_changed_at = @password_changed_at
  . = @invalid_login_attempts
  .invitation_sent_at = @invitation_sent_at
  . = @last_login
  .locked_until = @locked_until
  .comment = @comment

  return 
end

#get_user_paramsObject


105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/onelogin/api/models/user.rb', line 105

def get_user_params
  return {
    "external_id"=> self.external_id,
    "email"=> self.email,
    "username"=> self.username,
    "firstname"=> self.firstname,
    "lastname"=> self.lastname,
    "distinguished_name"=> self.distinguished_name,
    "phone"=> self.phone,
    "company"=> self.company,
    "department"=> self.department,
    "title"=> self.title,
    "status"=> self.status,
    "state"=> self.state,
    "member_of"=> self.member_of,
    "samaccountname"=> self.samaccountname,
    "invalid_login_attempts"=> self.,
    "userprincipalname"=> self.userprincipalname,
    "group_id"=> self.group_id,
    "locale_code"=> self.locale_code,
    "openid_name"=> self.openid_name,
    "directory_id"=> self.directory_id,
    "manager_ad_id"=> self.manager_ad_id,
    "trusted_idp_id"=> self.trusted_idp_id,
    "manager_user_id"=> self.manager_user_id
  }
end