Class: ShellCardManagementApIs::Role
- Defined in:
- lib/shell_card_management_ap_is/models/role.rb
Overview
Role Model.
Instance Attribute Summary collapse
-
#is_customer_admin ⇒ TrueClass | FalseClass
Whether the role is an administrator.
-
#is_customer_user ⇒ TrueClass | FalseClass
Whether the role is a customer user.
-
#is_service_account ⇒ TrueClass | FalseClass
True/False.
-
#is_shell_admin ⇒ TrueClass | FalseClass
True if the role is Shell user, else false.
-
#is_user_admin ⇒ TrueClass | FalseClass
True/False.
-
#role_name ⇒ String
Role Name of the user.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(role_name = SKIP, is_customer_admin = true, is_customer_user = false, is_shell_admin = false, is_service_account = false, is_user_admin = true) ⇒ Role
constructor
A new instance of Role.
Methods inherited from BaseModel
Constructor Details
#initialize(role_name = SKIP, is_customer_admin = true, is_customer_user = false, is_shell_admin = false, is_service_account = false, is_user_admin = true) ⇒ Role
Returns a new instance of Role.
67 68 69 70 71 72 73 74 75 76 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 67 def initialize(role_name = SKIP, is_customer_admin = true, is_customer_user = false, is_shell_admin = false, is_service_account = false, is_user_admin = true) @role_name = role_name unless role_name == SKIP @is_customer_admin = is_customer_admin unless is_customer_admin == SKIP @is_customer_user = is_customer_user unless is_customer_user == SKIP @is_shell_admin = is_shell_admin unless is_shell_admin == SKIP @is_service_account = is_service_account unless is_service_account == SKIP @is_user_admin = is_user_admin unless is_user_admin == SKIP end |
Instance Attribute Details
#is_customer_admin ⇒ TrueClass | FalseClass
Whether the role is an administrator.
18 19 20 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 18 def is_customer_admin @is_customer_admin end |
#is_customer_user ⇒ TrueClass | FalseClass
Whether the role is a customer user.
22 23 24 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 22 def is_customer_user @is_customer_user end |
#is_service_account ⇒ TrueClass | FalseClass
True/False. True if the role is Service accounts, else false.
31 32 33 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 31 def is_service_account @is_service_account end |
#is_shell_admin ⇒ TrueClass | FalseClass
True if the role is Shell user, else false.
26 27 28 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 26 def is_shell_admin @is_shell_admin end |
#is_user_admin ⇒ TrueClass | FalseClass
True/False. True, if the role allows user administration, else false.
36 37 38 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 36 def is_user_admin @is_user_admin end |
#role_name ⇒ String
Role Name of the user
14 15 16 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 14 def role_name @role_name end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 79 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. role_name = hash.key?('RoleName') ? hash['RoleName'] : SKIP is_customer_admin = hash['IsCustomerAdmin'] ||= true is_customer_user = hash['IsCustomerUser'] ||= false is_shell_admin = hash['IsShellAdmin'] ||= false is_service_account = hash['IsServiceAccount'] ||= false is_user_admin = hash['IsUserAdmin'] ||= true # Create object from extracted values. Role.new(role_name, is_customer_admin, is_customer_user, is_shell_admin, is_service_account, is_user_admin) end |
.names ⇒ Object
A mapping from model property names to API property names.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 39 def self.names @_hash = {} if @_hash.nil? @_hash['role_name'] = 'RoleName' @_hash['is_customer_admin'] = 'IsCustomerAdmin' @_hash['is_customer_user'] = 'IsCustomerUser' @_hash['is_shell_admin'] = 'IsShellAdmin' @_hash['is_service_account'] = 'IsServiceAccount' @_hash['is_user_admin'] = 'IsUserAdmin' @_hash end |
.nullables ⇒ Object
An array for nullable fields
63 64 65 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 63 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/shell_card_management_ap_is/models/role.rb', line 51 def self.optionals %w[ role_name is_customer_admin is_customer_user is_shell_admin is_service_account is_user_admin ] end |