Class: Comet::UserProfileConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/models/user_profile_config.rb

Overview

UserProfileConfig is a typed class wrapper around the underlying Comet Server API data structure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeUserProfileConfig

Returns a new instance of UserProfileConfig.



104
105
106
# File 'lib/comet/models/user_profile_config.rb', line 104

def initialize
  clear
end

Instance Attribute Details

#account_nameObject

Returns the value of attribute account_name.



21
22
23
# File 'lib/comet/models/user_profile_config.rb', line 21

def 
  @account_name
end

#all_protected_items_quota_bytesObject

Returns the value of attribute all_protected_items_quota_bytes.



60
61
62
# File 'lib/comet/models/user_profile_config.rb', line 60

def all_protected_items_quota_bytes
  @all_protected_items_quota_bytes
end

#all_protected_items_quota_enabledObject

Returns the value of attribute all_protected_items_quota_enabled.



57
58
59
# File 'lib/comet/models/user_profile_config.rb', line 57

def all_protected_items_quota_enabled
  @all_protected_items_quota_enabled
end

#allow_password_and_totploginObject

Returns the value of attribute allow_password_and_totplogin.



84
85
86
# File 'lib/comet/models/user_profile_config.rb', line 84

def allow_password_and_totplogin
  @allow_password_and_totplogin
end

#allow_password_loginObject

Returns the value of attribute allow_password_login.



81
82
83
# File 'lib/comet/models/user_profile_config.rb', line 81

def 
  
end

#backup_rulesObject

Returns the value of attribute backup_rules.



48
49
50
# File 'lib/comet/models/user_profile_config.rb', line 48

def backup_rules
  @backup_rules
end

#create_timeObject

Returns the value of attribute create_time.



96
97
98
# File 'lib/comet/models/user_profile_config.rb', line 96

def create_time
  @create_time
end

#creation_guidObject

Returns the value of attribute creation_guid.



99
100
101
# File 'lib/comet/models/user_profile_config.rb', line 99

def creation_guid
  @creation_guid
end

#destinationsObject

Returns the value of attribute destinations.



42
43
44
# File 'lib/comet/models/user_profile_config.rb', line 42

def destinations
  @destinations
end

#devicesObject

Returns the value of attribute devices.



51
52
53
# File 'lib/comet/models/user_profile_config.rb', line 51

def devices
  @devices
end

#emailsObject

Returns the value of attribute emails.



33
34
35
# File 'lib/comet/models/user_profile_config.rb', line 33

def emails
  @emails
end

#is_suspendedObject

Returns the value of attribute is_suspended.



54
55
56
# File 'lib/comet/models/user_profile_config.rb', line 54

def is_suspended
  @is_suspended
end

#language_codeObject

Returns the value of attribute language_code.



27
28
29
# File 'lib/comet/models/user_profile_config.rb', line 27

def language_code
  @language_code
end

#local_timezoneObject

Returns the value of attribute local_timezone.



24
25
26
# File 'lib/comet/models/user_profile_config.rb', line 24

def local_timezone
  @local_timezone
end

#maximum_devicesObject

Returns the value of attribute maximum_devices.



63
64
65
# File 'lib/comet/models/user_profile_config.rb', line 63

def maximum_devices
  @maximum_devices
end

#organization_idObject

Returns the value of attribute organization_id.



30
31
32
# File 'lib/comet/models/user_profile_config.rb', line 30

def organization_id
  @organization_id
end

#override_email_settingsObject

Returns the value of attribute override_email_settings.



36
37
38
# File 'lib/comet/models/user_profile_config.rb', line 36

def override_email_settings
  @override_email_settings
end

#password_formatObject

Returns the value of attribute password_format.



72
73
74
# File 'lib/comet/models/user_profile_config.rb', line 72

def password_format
  @password_format
end

#password_hashObject

Returns the value of attribute password_hash.



75
76
77
# File 'lib/comet/models/user_profile_config.rb', line 75

def password_hash
  @password_hash
end

#password_recoveryObject

Returns the value of attribute password_recovery.



78
79
80
# File 'lib/comet/models/user_profile_config.rb', line 78

def password_recovery
  @password_recovery
end

#policyObject

Returns the value of attribute policy.



69
70
71
# File 'lib/comet/models/user_profile_config.rb', line 69

def policy
  @policy
end

#policy_idObject

Returns the value of attribute policy_id.



66
67
68
# File 'lib/comet/models/user_profile_config.rb', line 66

def policy_id
  @policy_id
end

#require_password_changeObject

Returns the value of attribute require_password_change.



93
94
95
# File 'lib/comet/models/user_profile_config.rb', line 93

def require_password_change
  @require_password_change
end

#send_email_reportsObject

Returns the value of attribute send_email_reports.



39
40
41
# File 'lib/comet/models/user_profile_config.rb', line 39

def send_email_reports
  @send_email_reports
end

#sourcesObject

Returns the value of attribute sources.



45
46
47
# File 'lib/comet/models/user_profile_config.rb', line 45

def sources
  @sources
end

#totpkeyObject

Returns the value of attribute totpkey.



90
91
92
# File 'lib/comet/models/user_profile_config.rb', line 90

def totpkey
  @totpkey
end

#totpkey_encryption_formatObject

Returns the value of attribute totpkey_encryption_format.



87
88
89
# File 'lib/comet/models/user_profile_config.rb', line 87

def totpkey_encryption_format
  @totpkey_encryption_format
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



102
103
104
# File 'lib/comet/models/user_profile_config.rb', line 102

def unknown_json_fields
  @unknown_json_fields
end

#usernameObject

Returns the value of attribute username.



18
19
20
# File 'lib/comet/models/user_profile_config.rb', line 18

def username
  @username
end

Instance Method Details

#clearObject



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/comet/models/user_profile_config.rb', line 108

def clear
  @username = ''
  @account_name = ''
  @local_timezone = ''
  @language_code = ''
  @organization_id = ''
  @emails = []
  @override_email_settings = {}
  @destinations = {}
  @sources = {}
  @backup_rules = {}
  @devices = {}
  @all_protected_items_quota_bytes = 0
  @maximum_devices = 0
  @policy_id = ''
  @policy = Comet::UserPolicy.new
  @password_format = 0
  @password_hash = ''
  @password_recovery = ''
  @totpkey_encryption_format = 0
  @totpkey = ''
  @create_time = 0
  @creation_guid = ''
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/comet/models/user_profile_config.rb', line 142

def from_hash(obj)
  raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash

  obj.each do |k, v|
    case k
    when 'Username'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @username = v
    when 'AccountName'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @account_name = v
    when 'LocalTimezone'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @local_timezone = v
    when 'LanguageCode'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @language_code = v
    when 'OrganizationID'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @organization_id = v
    when 'Emails'
      if v.nil?
        @emails = []
      else
        @emails = Array.new(v.length)
        v.each_with_index do |v1, i1|
          raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String

          @emails[i1] = v1
        end
      end
    when 'OverrideEmailSettings'
      @override_email_settings = {}
      if v.nil?
        @override_email_settings = {}
      else
        v.each do |k1, v1|
          @override_email_settings[k1] = Comet::UserCustomEmailSettings.new
          @override_email_settings[k1].from_hash(v1)
        end
      end
    when 'SendEmailReports'
      @send_email_reports = v
    when 'Destinations'
      @destinations = {}
      if v.nil?
        @destinations = {}
      else
        v.each do |k1, v1|
          @destinations[k1] = Comet::DestinationConfig.new
          @destinations[k1].from_hash(v1)
        end
      end
    when 'Sources'
      @sources = {}
      if v.nil?
        @sources = {}
      else
        v.each do |k1, v1|
          @sources[k1] = Comet::SourceConfig.new
          @sources[k1].from_hash(v1)
        end
      end
    when 'BackupRules'
      @backup_rules = {}
      if v.nil?
        @backup_rules = {}
      else
        v.each do |k1, v1|
          @backup_rules[k1] = Comet::BackupRuleConfig.new
          @backup_rules[k1].from_hash(v1)
        end
      end
    when 'Devices'
      @devices = {}
      if v.nil?
        @devices = {}
      else
        v.each do |k1, v1|
          @devices[k1] = Comet::DeviceConfig.new
          @devices[k1].from_hash(v1)
        end
      end
    when 'IsSuspended'
      @is_suspended = v
    when 'AllProtectedItemsQuotaEnabled'
      @all_protected_items_quota_enabled = v
    when 'AllProtectedItemsQuotaBytes'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @all_protected_items_quota_bytes = v
    when 'MaximumDevices'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @maximum_devices = v
    when 'PolicyID'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @policy_id = v
    when 'Policy'
      @policy = Comet::UserPolicy.new
      @policy.from_hash(v)
    when 'PasswordFormat'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @password_format = v
    when 'PasswordHash'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @password_hash = v
    when 'PasswordRecovery'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @password_recovery = v
    when 'AllowPasswordLogin'
       = v
    when 'AllowPasswordAndTOTPLogin'
      @allow_password_and_totplogin = v
    when 'TOTPKeyEncryptionFormat'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @totpkey_encryption_format = v
    when 'TOTPKey'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @totpkey = v
    when 'RequirePasswordChange'
      @require_password_change = v
    when 'CreateTime'
      raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric

      @create_time = v
    when 'CreationGUID'
      raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String

      @creation_guid = v
    else
      @unknown_json_fields[k] = v
    end
  end
end

#from_json(json_string) ⇒ Object

Parameters:

  • json_string (String)

    The complete object in JSON format

Raises:

  • (TypeError)


135
136
137
138
139
# File 'lib/comet/models/user_profile_config.rb', line 135

def from_json(json_string)
  raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String

  from_hash(JSON.parse(json_string))
end

#to_hHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



331
332
333
# File 'lib/comet/models/user_profile_config.rb', line 331

def to_h
  to_hash
end

#to_hashHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/comet/models/user_profile_config.rb', line 290

def to_hash
  ret = {}
  ret['Username'] = @username
  ret['AccountName'] = @account_name
  ret['LocalTimezone'] = @local_timezone
  ret['LanguageCode'] = @language_code
  unless @organization_id.nil?
    ret['OrganizationID'] = @organization_id
  end
  ret['Emails'] = @emails
  ret['OverrideEmailSettings'] = @override_email_settings
  ret['SendEmailReports'] = @send_email_reports
  ret['Destinations'] = @destinations
  ret['Sources'] = @sources
  ret['BackupRules'] = @backup_rules
  ret['Devices'] = @devices
  ret['IsSuspended'] = @is_suspended
  ret['AllProtectedItemsQuotaEnabled'] = @all_protected_items_quota_enabled
  ret['AllProtectedItemsQuotaBytes'] = @all_protected_items_quota_bytes
  ret['MaximumDevices'] = @maximum_devices
  ret['PolicyID'] = @policy_id
  ret['Policy'] = @policy
  ret['PasswordFormat'] = @password_format
  ret['PasswordHash'] = @password_hash
  unless @password_recovery.nil?
    ret['PasswordRecovery'] = @password_recovery
  end
  ret['AllowPasswordLogin'] = 
  ret['AllowPasswordAndTOTPLogin'] = @allow_password_and_totplogin
  ret['TOTPKeyEncryptionFormat'] = @totpkey_encryption_format
  ret['TOTPKey'] = @totpkey
  ret['RequirePasswordChange'] = @require_password_change
  ret['CreateTime'] = @create_time
  ret['CreationGUID'] = @creation_guid
  @unknown_json_fields.each do |k, v|
    ret[k] = v
  end
  ret
end

#to_json(options = {}) ⇒ String

Returns The complete object as a JSON string.

Returns:

  • (String)

    The complete object as a JSON string



336
337
338
# File 'lib/comet/models/user_profile_config.rb', line 336

def to_json(options = {})
  to_hash.to_json(options)
end