Class: ShellDataReportingApIs::LoggedInUserResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb

Overview

LoggedInUserResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(user_name = SKIP, display_name = SKIP, id_mssoid = SKIP, preferred_language = SKIP, is_super_admin = false, date_format = SKIP, time_format = SKIP, week_begins = SKIP, display_week = true, csv_separator = SKIP, decimal_separator = SKIP, report_format = SKIP, has_api_access = true, roles = SKIP, payers = SKIP, accounts = SKIP, collecting_companies = SKIP, eid_access_details = SKIP, user_classification_by_system = SKIP, user_classification_by_shell = SKIP, payer_count = SKIP, account_count = SKIP, card_count = SKIP, error = SKIP, request_id = SKIP) ⇒ LoggedInUserResponse

Returns a new instance of LoggedInUserResponse.



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
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 228

def initialize(user_name = SKIP, display_name = SKIP, id_mssoid = SKIP,
               preferred_language = SKIP, is_super_admin = false,
               date_format = SKIP, time_format = SKIP, week_begins = SKIP,
               display_week = true, csv_separator = SKIP,
               decimal_separator = SKIP, report_format = SKIP,
               has_api_access = true, roles = SKIP, payers = SKIP,
               accounts = SKIP, collecting_companies = SKIP,
               eid_access_details = SKIP,
               user_classification_by_system = SKIP,
               user_classification_by_shell = SKIP, payer_count = SKIP,
                = SKIP, card_count = SKIP, error = SKIP,
               request_id = SKIP)
  @user_name = user_name unless user_name == SKIP
  @display_name = display_name unless display_name == SKIP
  @id_mssoid = id_mssoid unless id_mssoid == SKIP
  @preferred_language = preferred_language unless preferred_language == SKIP
  @is_super_admin = is_super_admin unless is_super_admin == SKIP
  @date_format = date_format unless date_format == SKIP
  @time_format = time_format unless time_format == SKIP
  @week_begins = week_begins unless week_begins == SKIP
  @display_week = display_week unless display_week == SKIP
  @csv_separator = csv_separator unless csv_separator == SKIP
  @decimal_separator = decimal_separator unless decimal_separator == SKIP
  @report_format = report_format unless report_format == SKIP
  @has_api_access = has_api_access unless has_api_access == SKIP
  @roles = roles unless roles == SKIP
  @payers = payers unless payers == SKIP
  @accounts = accounts unless accounts == SKIP
  @collecting_companies = collecting_companies unless collecting_companies == SKIP
  @eid_access_details = eid_access_details unless eid_access_details == SKIP
  unless user_classification_by_system == SKIP
    @user_classification_by_system =
      user_classification_by_system
  end
  unless user_classification_by_shell == SKIP
    @user_classification_by_shell =
      user_classification_by_shell
  end
  @payer_count = payer_count unless payer_count == SKIP
  @account_count =  unless  == SKIP
  @card_count = card_count unless card_count == SKIP
  @error = error unless error == SKIP
  @request_id = request_id unless request_id == SKIP
end

Instance Attribute Details

#account_countInteger

Count of accounts at the time when the user was created or last updated. Note: Count may vary based on customer operations hence it may not be an up to date value.

Returns:

  • (Integer)


125
126
127
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 125

def 
  @account_count
end

#accountsArray[AccountAccess]

List of accounts which the user has access to. Note: This list will be empty for users mapped with roles which has either IsCustomerAdmin, IsShellAdmin or IsServiceAccount set to true as their access level is controller at either ColCo or payer level only.

Returns:



89
90
91
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 89

def accounts
  @accounts
end

#card_countInteger

Count of cards at the time when the user was created or last updated. Note: Count may vary based on customer operations hence it may not be an up to date value.

Returns:

  • (Integer)


132
133
134
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 132

def card_count
  @card_count
end

#collecting_companiesArray[ColCoAccess]

List of collecting companies to which the user has access to Note: This list will be empty for users mapped with roles which has either IsCustomerAdmin or IsCustomerUser set to true as their access level is controller at Payer or Account level.

Returns:



96
97
98
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 96

def collecting_companies
  @collecting_companies
end

#csv_separatorString

Preferred CSV Separator for the logged in user.

Returns:

  • (String)


51
52
53
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 51

def csv_separator
  @csv_separator
end

#date_formatString

Preferred Date format for the logged in user

Returns:

  • (String)


34
35
36
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 34

def date_format
  @date_format
end

#decimal_separatorString

Preferred Decimal separator configured for the logged in user Note: - Colco default value (configured at Microservices) is returned when the user is not provided or does not exist.

Returns:

  • (String)


57
58
59
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 57

def decimal_separator
  @decimal_separator
end

#display_nameString

Name of the logged in user.

Returns:

  • (String)


18
19
20
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 18

def display_name
  @display_name
end

#display_weekTrueClass | FalseClass

Preferred Display Week on Fuel Prices configuration for the logged in User.

Returns:

  • (TrueClass | FalseClass)


47
48
49
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 47

def display_week
  @display_week
end

#eid_access_detailsArray[EIDAccess]

List of Electronic Invoice Data configured for the user. Note: This list will be empty if the value of EIDDetails is set to false or empty in the request.

Returns:



102
103
104
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 102

def eid_access_details
  @eid_access_details
end

#errorErrorStatus

Count of cards at the time when the user was created or last updated. Note: Count may vary based on customer operations hence it may not be an up to date value.

Returns:



139
140
141
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 139

def error
  @error
end

#has_api_accessTrueClass | FalseClass

True/False True, if user has access to the requested API. This is validated based on the role Vs API access matrix and client Vs API access matrix.

Returns:

  • (TrueClass | FalseClass)


67
68
69
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 67

def has_api_access
  @has_api_access
end

#id_mssoidString

Single Sign On/Unique Identifier of the User in Identity Management system

Returns:

  • (String)


22
23
24
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 22

def id_mssoid
  @id_mssoid
end

#is_super_adminTrueClass | FalseClass

Whether the user is a super administrator

Returns:

  • (TrueClass | FalseClass)


30
31
32
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 30

def is_super_admin
  @is_super_admin
end

#payer_countInteger

Count of payers accessible to the user at the time when user was created or last updated. Note: Count may vary based on customer operations hence it may not be an up to date value.

Returns:

  • (Integer)


118
119
120
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 118

def payer_count
  @payer_count
end

#payersArray[PayerAccess]

List of payers which the user has access to. • It will return 250 payers only and it is configurable. If the user has more than that, the remaining will be ignored. • The payer which is marked as default will be the first item in the output. Note: This list will be empty for users mapped with roles which has either IsShellAdmin or IsServiceAccount set to true as their access level is controlled at ColCo level only.

Returns:



82
83
84
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 82

def payers
  @payers
end

#preferred_languageString

ISO culture code/ Language chosen by the logged in user

Returns:

  • (String)


26
27
28
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 26

def preferred_language
  @preferred_language
end

#report_formatString

Preferred report format configured for the logged in user

Returns:

  • (String)


61
62
63
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 61

def report_format
  @report_format
end

#request_idString

Request Id of the API call

Returns:

  • (String)


143
144
145
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 143

def request_id
  @request_id
end

#rolesArray[Role]

List of roles the user have access to

Returns:



71
72
73
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 71

def roles
  @roles
end

#time_formatString

Preferred Time format for the logged in user

Returns:

  • (String)


38
39
40
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 38

def time_format
  @time_format
end

#user_classification_by_shellString

User classification by Shell.

Returns:

  • (String)


110
111
112
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 110

def user_classification_by_shell
  @user_classification_by_shell
end

#user_classification_by_systemString

User classification by system.

Returns:

  • (String)


106
107
108
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 106

def user_classification_by_system
  @user_classification_by_system
end

#user_nameString

Logged in User Identifier

Returns:

  • (String)


14
15
16
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 14

def user_name
  @user_name
end

#week_beginsInteger

Preferred Day to Begin the Week. The value will be between 1 to 7 or null.

Returns:

  • (Integer)


42
43
44
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 42

def week_begins
  @week_begins
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
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
371
372
373
374
375
376
377
378
379
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 274

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  user_name = hash.key?('UserName') ? hash['UserName'] : SKIP
  display_name = hash.key?('DisplayName') ? hash['DisplayName'] : SKIP
  id_mssoid = hash.key?('IdMSSOID') ? hash['IdMSSOID'] : SKIP
  preferred_language =
    hash.key?('PreferredLanguage') ? hash['PreferredLanguage'] : SKIP
  is_super_admin = hash['IsSuperAdmin'] ||= false
  date_format = hash.key?('DateFormat') ? hash['DateFormat'] : SKIP
  time_format = hash.key?('TimeFormat') ? hash['TimeFormat'] : SKIP
  week_begins = hash.key?('WeekBegins') ? hash['WeekBegins'] : SKIP
  display_week = hash['DisplayWeek'] ||= true
  csv_separator = hash.key?('CSVSeparator') ? hash['CSVSeparator'] : SKIP
  decimal_separator =
    hash.key?('DecimalSeparator') ? hash['DecimalSeparator'] : SKIP
  report_format = hash.key?('ReportFormat') ? hash['ReportFormat'] : SKIP
  has_api_access = hash['HasAPIAccess'] ||= true
  # Parameter is an array, so we need to iterate through it
  roles = nil
  unless hash['Roles'].nil?
    roles = []
    hash['Roles'].each do |structure|
      roles << (Role.from_hash(structure) if structure)
    end
  end

  roles = SKIP unless hash.key?('Roles')
  # Parameter is an array, so we need to iterate through it
  payers = nil
  unless hash['Payers'].nil?
    payers = []
    hash['Payers'].each do |structure|
      payers << (PayerAccess.from_hash(structure) if structure)
    end
  end

  payers = SKIP unless hash.key?('Payers')
  # Parameter is an array, so we need to iterate through it
  accounts = nil
  unless hash['Accounts'].nil?
    accounts = []
    hash['Accounts'].each do |structure|
      accounts << (AccountAccess.from_hash(structure) if structure)
    end
  end

  accounts = SKIP unless hash.key?('Accounts')
  # Parameter is an array, so we need to iterate through it
  collecting_companies = nil
  unless hash['CollectingCompanies'].nil?
    collecting_companies = []
    hash['CollectingCompanies'].each do |structure|
      collecting_companies << (ColCoAccess.from_hash(structure) if structure)
    end
  end

  collecting_companies = SKIP unless hash.key?('CollectingCompanies')
  # Parameter is an array, so we need to iterate through it
  eid_access_details = nil
  unless hash['EIDAccessDetails'].nil?
    eid_access_details = []
    hash['EIDAccessDetails'].each do |structure|
      eid_access_details << (EIDAccess.from_hash(structure) if structure)
    end
  end

  eid_access_details = SKIP unless hash.key?('EIDAccessDetails')
  user_classification_by_system =
    hash.key?('UserClassificationBySystem') ? hash['UserClassificationBySystem'] : SKIP
  user_classification_by_shell =
    hash.key?('UserClassificationByShell') ? hash['UserClassificationByShell'] : SKIP
  payer_count = hash.key?('PayerCount') ? hash['PayerCount'] : SKIP
   = hash.key?('AccountCount') ? hash['AccountCount'] : SKIP
  card_count = hash.key?('CardCount') ? hash['CardCount'] : SKIP
  error = ErrorStatus.from_hash(hash['Error']) if hash['Error']
  request_id = hash.key?('RequestId') ? hash['RequestId'] : SKIP

  # Create object from extracted values.
  LoggedInUserResponse.new(user_name,
                           display_name,
                           id_mssoid,
                           preferred_language,
                           is_super_admin,
                           date_format,
                           time_format,
                           week_begins,
                           display_week,
                           csv_separator,
                           decimal_separator,
                           report_format,
                           has_api_access,
                           roles,
                           payers,
                           accounts,
                           collecting_companies,
                           eid_access_details,
                           user_classification_by_system,
                           user_classification_by_shell,
                           payer_count,
                           ,
                           card_count,
                           error,
                           request_id)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 146

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['user_name'] = 'UserName'
  @_hash['display_name'] = 'DisplayName'
  @_hash['id_mssoid'] = 'IdMSSOID'
  @_hash['preferred_language'] = 'PreferredLanguage'
  @_hash['is_super_admin'] = 'IsSuperAdmin'
  @_hash['date_format'] = 'DateFormat'
  @_hash['time_format'] = 'TimeFormat'
  @_hash['week_begins'] = 'WeekBegins'
  @_hash['display_week'] = 'DisplayWeek'
  @_hash['csv_separator'] = 'CSVSeparator'
  @_hash['decimal_separator'] = 'DecimalSeparator'
  @_hash['report_format'] = 'ReportFormat'
  @_hash['has_api_access'] = 'HasAPIAccess'
  @_hash['roles'] = 'Roles'
  @_hash['payers'] = 'Payers'
  @_hash['accounts'] = 'Accounts'
  @_hash['collecting_companies'] = 'CollectingCompanies'
  @_hash['eid_access_details'] = 'EIDAccessDetails'
  @_hash['user_classification_by_system'] = 'UserClassificationBySystem'
  @_hash['user_classification_by_shell'] = 'UserClassificationByShell'
  @_hash['payer_count'] = 'PayerCount'
  @_hash['account_count'] = 'AccountCount'
  @_hash['card_count'] = 'CardCount'
  @_hash['error'] = 'Error'
  @_hash['request_id'] = 'RequestId'
  @_hash
end

.nullablesObject

An array for nullable fields



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 208

def self.nullables
  %w[
    user_name
    display_name
    id_mssoid
    preferred_language
    date_format
    time_format
    week_begins
    csv_separator
    decimal_separator
    report_format
    user_classification_by_system
    user_classification_by_shell
    payer_count
    account_count
    card_count
  ]
end

.optionalsObject

An array for optional fields



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
# File 'lib/shell_data_reporting_ap_is/models/logged_in_user_response.rb', line 177

def self.optionals
  %w[
    user_name
    display_name
    id_mssoid
    preferred_language
    is_super_admin
    date_format
    time_format
    week_begins
    display_week
    csv_separator
    decimal_separator
    report_format
    has_api_access
    roles
    payers
    accounts
    collecting_companies
    eid_access_details
    user_classification_by_system
    user_classification_by_shell
    payer_count
    account_count
    card_count
    error
    request_id
  ]
end