Class: MistApi::Admin
- Defined in:
- lib/mist_api/models/admin.rb
Overview
Admin Model.
Instance Attribute Summary collapse
-
#admin_id ⇒ UUID | String
ID of the administrator.
-
#compliance_status ⇒ AdminComplianceStatusEnum
trade compliance status.
-
#email ⇒ String
If admin account is not an Org API Token.
-
#enable_two_factor ⇒ TrueClass | FalseClass
If admin account is not an Org API Token.
-
#expire_time ⇒ Integer
If admin account is not an Org API Token.
-
#first_name ⇒ String
If admin account is not an Org API Token.
-
#hours ⇒ Integer
If admin account is not an Org API Token, how long the invite should be valid.
-
#last_name ⇒ String
If admin account is not an Org API Token.
-
#name ⇒ String
For Org API Token Only.
-
#no_tracking ⇒ TrueClass | FalseClass
Optional, whether to store privacy-consent information.
-
#oauth_google ⇒ TrueClass | FalseClass
If admin account is not an Org API Token.
-
#password_modified_time ⇒ Float
Password last modified time, in epoch.
-
#phone ⇒ String
If admin account is not an Org API Token.
-
#phone2 ⇒ String
If admin account is not an Org API Token.
-
#privileges ⇒ Array[AdminPrivilege]
List of privileges the admin has.
-
#session_expiry ⇒ Integer
List of privileges the admin has.
-
#tags ⇒ Array[String]
List of privileges the admin has.
-
#two_factor_verified ⇒ TrueClass | FalseClass
If admin account is not an Org API Token.
-
#via_sso ⇒ TrueClass | FalseClass
If admin account is not an Org API Token, an admin login via_sso is more restircted.
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(admin_id = SKIP, compliance_status = SKIP, email = SKIP, enable_two_factor = SKIP, expire_time = SKIP, first_name = SKIP, hours = 24, last_name = SKIP, name = SKIP, no_tracking = SKIP, oauth_google = SKIP, password_modified_time = SKIP, phone = SKIP, phone2 = SKIP, privileges = SKIP, session_expiry = SKIP, tags = SKIP, two_factor_verified = SKIP, via_sso = SKIP, additional_properties = nil) ⇒ Admin
constructor
A new instance of Admin.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(admin_id = SKIP, compliance_status = SKIP, email = SKIP, enable_two_factor = SKIP, expire_time = SKIP, first_name = SKIP, hours = 24, last_name = SKIP, name = SKIP, no_tracking = SKIP, oauth_google = SKIP, password_modified_time = SKIP, phone = SKIP, phone2 = SKIP, privileges = SKIP, session_expiry = SKIP, tags = SKIP, two_factor_verified = SKIP, via_sso = SKIP, additional_properties = nil) ⇒ Admin
Returns a new instance of Admin.
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 |
# File 'lib/mist_api/models/admin.rb', line 153 def initialize(admin_id = SKIP, compliance_status = SKIP, email = SKIP, enable_two_factor = SKIP, expire_time = SKIP, first_name = SKIP, hours = 24, last_name = SKIP, name = SKIP, no_tracking = SKIP, oauth_google = SKIP, password_modified_time = SKIP, phone = SKIP, phone2 = SKIP, privileges = SKIP, session_expiry = SKIP, = SKIP, two_factor_verified = SKIP, via_sso = SKIP, additional_properties = nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @admin_id = admin_id unless admin_id == SKIP @compliance_status = compliance_status unless compliance_status == SKIP @email = email unless email == SKIP @enable_two_factor = enable_two_factor unless enable_two_factor == SKIP @expire_time = expire_time unless expire_time == SKIP @first_name = first_name unless first_name == SKIP @hours = hours unless hours == SKIP @last_name = last_name unless last_name == SKIP @name = name unless name == SKIP @no_tracking = no_tracking unless no_tracking == SKIP @oauth_google = oauth_google unless oauth_google == SKIP @password_modified_time = password_modified_time unless password_modified_time == SKIP @phone = phone unless phone == SKIP @phone2 = phone2 unless phone2 == SKIP @privileges = privileges unless privileges == SKIP @session_expiry = session_expiry unless session_expiry == SKIP @tags = unless == SKIP @two_factor_verified = two_factor_verified unless two_factor_verified == SKIP @via_sso = via_sso unless via_sso == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#admin_id ⇒ UUID | String
ID of the administrator
14 15 16 |
# File 'lib/mist_api/models/admin.rb', line 14 def admin_id @admin_id end |
#compliance_status ⇒ AdminComplianceStatusEnum
trade compliance status. enum: ‘blocked`, `restricted`
18 19 20 |
# File 'lib/mist_api/models/admin.rb', line 18 def compliance_status @compliance_status end |
#email ⇒ String
If admin account is not an Org API Token
22 23 24 |
# File 'lib/mist_api/models/admin.rb', line 22 def email @email end |
#enable_two_factor ⇒ TrueClass | FalseClass
If admin account is not an Org API Token
26 27 28 |
# File 'lib/mist_api/models/admin.rb', line 26 def enable_two_factor @enable_two_factor end |
#expire_time ⇒ Integer
If admin account is not an Org API Token
30 31 32 |
# File 'lib/mist_api/models/admin.rb', line 30 def expire_time @expire_time end |
#first_name ⇒ String
If admin account is not an Org API Token. For an invite, this is the original first name used
35 36 37 |
# File 'lib/mist_api/models/admin.rb', line 35 def first_name @first_name end |
#hours ⇒ Integer
If admin account is not an Org API Token, how long the invite should be valid
40 41 42 |
# File 'lib/mist_api/models/admin.rb', line 40 def hours @hours end |
#last_name ⇒ String
If admin account is not an Org API Token. For an invite, this is the original last name used
45 46 47 |
# File 'lib/mist_api/models/admin.rb', line 45 def last_name @last_name end |
#name ⇒ String
For Org API Token Only
49 50 51 |
# File 'lib/mist_api/models/admin.rb', line 49 def name @name end |
#no_tracking ⇒ TrueClass | FalseClass
Optional, whether to store privacy-consent information. When it doesn’t exist, it’s assumed true on EU (i.e. no tracking, the user has to opt-in); otherwise, the user would have to opt-out
55 56 57 |
# File 'lib/mist_api/models/admin.rb', line 55 def no_tracking @no_tracking end |
#oauth_google ⇒ TrueClass | FalseClass
If admin account is not an Org API Token
59 60 61 |
# File 'lib/mist_api/models/admin.rb', line 59 def oauth_google @oauth_google end |
#password_modified_time ⇒ Float
Password last modified time, in epoch
63 64 65 |
# File 'lib/mist_api/models/admin.rb', line 63 def password_modified_time @password_modified_time end |
#phone ⇒ String
If admin account is not an Org API Token. Phone number (numbers only, including country code)
68 69 70 |
# File 'lib/mist_api/models/admin.rb', line 68 def phone @phone end |
#phone2 ⇒ String
If admin account is not an Org API Token. Secondary phone number (numbers only, including country code)
73 74 75 |
# File 'lib/mist_api/models/admin.rb', line 73 def phone2 @phone2 end |
#privileges ⇒ Array[AdminPrivilege]
List of privileges the admin has
77 78 79 |
# File 'lib/mist_api/models/admin.rb', line 77 def privileges @privileges end |
#session_expiry ⇒ Integer
List of privileges the admin has
81 82 83 |
# File 'lib/mist_api/models/admin.rb', line 81 def session_expiry @session_expiry end |
#tags ⇒ Array[String]
List of privileges the admin has
85 86 87 |
# File 'lib/mist_api/models/admin.rb', line 85 def @tags end |
#two_factor_verified ⇒ TrueClass | FalseClass
If admin account is not an Org API Token. Two factor status
89 90 91 |
# File 'lib/mist_api/models/admin.rb', line 89 def two_factor_verified @two_factor_verified end |
#via_sso ⇒ TrueClass | FalseClass
If admin account is not an Org API Token, an admin login via_sso is more restircted. (password and email cannot be changed)
94 95 96 |
# File 'lib/mist_api/models/admin.rb', line 94 def via_sso @via_sso end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/mist_api/models/admin.rb', line 187 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. admin_id = hash.key?('admin_id') ? hash['admin_id'] : SKIP compliance_status = hash.key?('compliance_status') ? hash['compliance_status'] : SKIP email = hash.key?('email') ? hash['email'] : SKIP enable_two_factor = hash.key?('enable_two_factor') ? hash['enable_two_factor'] : SKIP expire_time = hash.key?('expire_time') ? hash['expire_time'] : SKIP first_name = hash.key?('first_name') ? hash['first_name'] : SKIP hours = hash['hours'] ||= 24 last_name = hash.key?('last_name') ? hash['last_name'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP no_tracking = hash.key?('no_tracking') ? hash['no_tracking'] : SKIP oauth_google = hash.key?('oauth_google') ? hash['oauth_google'] : SKIP password_modified_time = hash.key?('password_modified_time') ? hash['password_modified_time'] : SKIP phone = hash.key?('phone') ? hash['phone'] : SKIP phone2 = hash.key?('phone2') ? hash['phone2'] : SKIP # Parameter is an array, so we need to iterate through it privileges = nil unless hash['privileges'].nil? privileges = [] hash['privileges'].each do |structure| privileges << (AdminPrivilege.from_hash(structure) if structure) end end privileges = SKIP unless hash.key?('privileges') session_expiry = hash.key?('session_expiry') ? hash['session_expiry'] : SKIP = hash.key?('tags') ? hash['tags'] : SKIP two_factor_verified = hash.key?('two_factor_verified') ? hash['two_factor_verified'] : SKIP via_sso = hash.key?('via_sso') ? hash['via_sso'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. Admin.new(admin_id, compliance_status, email, enable_two_factor, expire_time, first_name, hours, last_name, name, no_tracking, oauth_google, password_modified_time, phone, phone2, privileges, session_expiry, , two_factor_verified, via_sso, additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/mist_api/models/admin.rb', line 97 def self.names @_hash = {} if @_hash.nil? @_hash['admin_id'] = 'admin_id' @_hash['compliance_status'] = 'compliance_status' @_hash['email'] = 'email' @_hash['enable_two_factor'] = 'enable_two_factor' @_hash['expire_time'] = 'expire_time' @_hash['first_name'] = 'first_name' @_hash['hours'] = 'hours' @_hash['last_name'] = 'last_name' @_hash['name'] = 'name' @_hash['no_tracking'] = 'no_tracking' @_hash['oauth_google'] = 'oauth_google' @_hash['password_modified_time'] = 'password_modified_time' @_hash['phone'] = 'phone' @_hash['phone2'] = 'phone2' @_hash['privileges'] = 'privileges' @_hash['session_expiry'] = 'session_expiry' @_hash['tags'] = 'tags' @_hash['two_factor_verified'] = 'two_factor_verified' @_hash['via_sso'] = 'via_sso' @_hash end |
.nullables ⇒ Object
An array for nullable fields
147 148 149 150 151 |
# File 'lib/mist_api/models/admin.rb', line 147 def self.nullables %w[ no_tracking ] end |
.optionals ⇒ Object
An array for optional fields
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/mist_api/models/admin.rb', line 122 def self.optionals %w[ admin_id compliance_status email enable_two_factor expire_time first_name hours last_name name no_tracking oauth_google password_modified_time phone phone2 privileges session_expiry tags two_factor_verified via_sso ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/mist_api/models/admin.rb', line 269 def inspect class_name = self.class.name.split('::').last "<#{class_name} admin_id: #{@admin_id.inspect}, compliance_status:"\ " #{@compliance_status.inspect}, email: #{@email.inspect}, enable_two_factor:"\ " #{@enable_two_factor.inspect}, expire_time: #{@expire_time.inspect}, first_name:"\ " #{@first_name.inspect}, hours: #{@hours.inspect}, last_name: #{@last_name.inspect}, name:"\ " #{@name.inspect}, no_tracking: #{@no_tracking.inspect}, oauth_google:"\ " #{@oauth_google.inspect}, password_modified_time: #{@password_modified_time.inspect},"\ " phone: #{@phone.inspect}, phone2: #{@phone2.inspect}, privileges: #{@privileges.inspect},"\ " session_expiry: #{@session_expiry.inspect}, tags: #{@tags.inspect}, two_factor_verified:"\ " #{@two_factor_verified.inspect}, via_sso: #{@via_sso.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/mist_api/models/admin.rb', line 256 def to_s class_name = self.class.name.split('::').last "<#{class_name} admin_id: #{@admin_id}, compliance_status: #{@compliance_status}, email:"\ " #{@email}, enable_two_factor: #{@enable_two_factor}, expire_time: #{@expire_time},"\ " first_name: #{@first_name}, hours: #{@hours}, last_name: #{@last_name}, name: #{@name},"\ " no_tracking: #{@no_tracking}, oauth_google: #{@oauth_google}, password_modified_time:"\ " #{@password_modified_time}, phone: #{@phone}, phone2: #{@phone2}, privileges:"\ " #{@privileges}, session_expiry: #{@session_expiry}, tags: #{@tags}, two_factor_verified:"\ " #{@two_factor_verified}, via_sso: #{@via_sso}, additional_properties:"\ " #{@additional_properties}>" end |