Class: Comet::ServerConfigOptions
- Inherits:
-
Object
- Object
- Comet::ServerConfigOptions
- Defined in:
- lib/comet/models/server_config_options.rb
Overview
ServerConfigOptions is a typed class wrapper around the underlying Comet Server API data structure.
Instance Attribute Summary collapse
-
#admin_users ⇒ Object
Returns the value of attribute admin_users.
-
#authentication_role ⇒ Object
Returns the value of attribute authentication_role.
-
#branding ⇒ Object
Returns the value of attribute branding.
-
#constellation_role ⇒ Object
Returns the value of attribute constellation_role.
-
#constellation_role__legacy ⇒ Object
Returns the value of attribute constellation_role__legacy.
-
#email ⇒ Object
Returns the value of attribute email.
-
#experimental_options ⇒ Object
Returns the value of attribute experimental_options.
-
#external_admin_user_sources ⇒ Object
Returns the value of attribute external_admin_user_sources.
-
#iprate_limit ⇒ Object
Returns the value of attribute iprate_limit.
-
#license ⇒ Object
Returns the value of attribute license.
-
#listen_addresses ⇒ Object
Returns the value of attribute listen_addresses.
-
#organizations ⇒ Object
Returns the value of attribute organizations.
-
#psaconfigs ⇒ Object
Returns the value of attribute psaconfigs.
-
#self_backup ⇒ Object
Returns the value of attribute self_backup.
-
#session_settings ⇒ Object
Returns the value of attribute session_settings.
-
#software_build_role ⇒ Object
Returns the value of attribute software_build_role.
-
#storage_role ⇒ Object
Returns the value of attribute storage_role.
-
#trust_xforwarded_for ⇒ Object
Returns the value of attribute trust_xforwarded_for.
-
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
-
#webhook_options ⇒ Object
Returns the value of attribute webhook_options.
Instance Method Summary collapse
- #clear ⇒ Object
- #from_hash(obj) ⇒ Object
- #from_json(json_string) ⇒ Object
-
#initialize ⇒ ServerConfigOptions
constructor
A new instance of ServerConfigOptions.
-
#to_h ⇒ Hash
The complete object as a Ruby hash.
-
#to_hash ⇒ Hash
The complete object as a Ruby hash.
-
#to_json(options = {}) ⇒ String
The complete object as a JSON string.
Constructor Details
#initialize ⇒ ServerConfigOptions
Returns a new instance of ServerConfigOptions.
75 76 77 |
# File 'lib/comet/models/server_config_options.rb', line 75 def initialize clear end |
Instance Attribute Details
#admin_users ⇒ Object
Returns the value of attribute admin_users.
16 17 18 |
# File 'lib/comet/models/server_config_options.rb', line 16 def admin_users @admin_users end |
#authentication_role ⇒ Object
Returns the value of attribute authentication_role.
19 20 21 |
# File 'lib/comet/models/server_config_options.rb', line 19 def authentication_role @authentication_role end |
#branding ⇒ Object
Returns the value of attribute branding.
22 23 24 |
# File 'lib/comet/models/server_config_options.rb', line 22 def branding @branding end |
#constellation_role ⇒ Object
Returns the value of attribute constellation_role.
25 26 27 |
# File 'lib/comet/models/server_config_options.rb', line 25 def constellation_role @constellation_role end |
#constellation_role__legacy ⇒ Object
Returns the value of attribute constellation_role__legacy.
28 29 30 |
# File 'lib/comet/models/server_config_options.rb', line 28 def constellation_role__legacy @constellation_role__legacy end |
#email ⇒ Object
Returns the value of attribute email.
31 32 33 |
# File 'lib/comet/models/server_config_options.rb', line 31 def email @email end |
#experimental_options ⇒ Object
Returns the value of attribute experimental_options.
34 35 36 |
# File 'lib/comet/models/server_config_options.rb', line 34 def @experimental_options end |
#external_admin_user_sources ⇒ Object
Returns the value of attribute external_admin_user_sources.
37 38 39 |
# File 'lib/comet/models/server_config_options.rb', line 37 def external_admin_user_sources @external_admin_user_sources end |
#iprate_limit ⇒ Object
Returns the value of attribute iprate_limit.
40 41 42 |
# File 'lib/comet/models/server_config_options.rb', line 40 def iprate_limit @iprate_limit end |
#license ⇒ Object
Returns the value of attribute license.
43 44 45 |
# File 'lib/comet/models/server_config_options.rb', line 43 def license @license end |
#listen_addresses ⇒ Object
Returns the value of attribute listen_addresses.
46 47 48 |
# File 'lib/comet/models/server_config_options.rb', line 46 def listen_addresses @listen_addresses end |
#organizations ⇒ Object
Returns the value of attribute organizations.
49 50 51 |
# File 'lib/comet/models/server_config_options.rb', line 49 def organizations @organizations end |
#psaconfigs ⇒ Object
Returns the value of attribute psaconfigs.
52 53 54 |
# File 'lib/comet/models/server_config_options.rb', line 52 def psaconfigs @psaconfigs end |
#self_backup ⇒ Object
Returns the value of attribute self_backup.
55 56 57 |
# File 'lib/comet/models/server_config_options.rb', line 55 def self_backup @self_backup end |
#session_settings ⇒ Object
Returns the value of attribute session_settings.
58 59 60 |
# File 'lib/comet/models/server_config_options.rb', line 58 def session_settings @session_settings end |
#software_build_role ⇒ Object
Returns the value of attribute software_build_role.
61 62 63 |
# File 'lib/comet/models/server_config_options.rb', line 61 def software_build_role @software_build_role end |
#storage_role ⇒ Object
Returns the value of attribute storage_role.
64 65 66 |
# File 'lib/comet/models/server_config_options.rb', line 64 def storage_role @storage_role end |
#trust_xforwarded_for ⇒ Object
Returns the value of attribute trust_xforwarded_for.
67 68 69 |
# File 'lib/comet/models/server_config_options.rb', line 67 def trust_xforwarded_for @trust_xforwarded_for end |
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
73 74 75 |
# File 'lib/comet/models/server_config_options.rb', line 73 def unknown_json_fields @unknown_json_fields end |
#webhook_options ⇒ Object
Returns the value of attribute webhook_options.
70 71 72 |
# File 'lib/comet/models/server_config_options.rb', line 70 def @webhook_options end |
Instance Method Details
#clear ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/comet/models/server_config_options.rb', line 79 def clear @admin_users = [] @authentication_role = Comet::AuthenticationRoleOptions.new @branding = Comet::BrandingOptions.new @constellation_role = Comet::ConstellationRoleOptions.new @constellation_role__legacy = Comet::ConstellationRoleOptions.new @email = Comet::EmailOptions.new @experimental_options = [] @external_admin_user_sources = {} @iprate_limit = Comet::RatelimitOptions.new @license = Comet::LicenseOptions.new @listen_addresses = [] @organizations = {} @psaconfigs = [] @self_backup = Comet::SelfBackupOptions.new @session_settings = Comet::SessionOptions.new @software_build_role = Comet::SoftwareBuildRoleOptions.new @storage_role = Comet::StorageRoleOptions.new @webhook_options = {} @unknown_json_fields = {} end |
#from_hash(obj) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 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 |
# File 'lib/comet/models/server_config_options.rb', line 109 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 'AdminUsers' if v.nil? @admin_users = [] else @admin_users = Array.new(v.length) v.each_with_index do |v1, i1| @admin_users[i1] = Comet::AllowedAdminUser.new @admin_users[i1].from_hash(v1) end end when 'AuthenticationRole' @authentication_role = Comet::AuthenticationRoleOptions.new @authentication_role.from_hash(v) when 'Branding' @branding = Comet::BrandingOptions.new @branding.from_hash(v) when 'ConstellationRole' @constellation_role = Comet::ConstellationRoleOptions.new @constellation_role.from_hash(v) when 'OverseerRole' @constellation_role__legacy = Comet::ConstellationRoleOptions.new @constellation_role__legacy.from_hash(v) when 'Email' @email = Comet::EmailOptions.new @email.from_hash(v) when 'ExperimentalOptions' if v.nil? @experimental_options = [] else @experimental_options = Array.new(v.length) v.each_with_index do |v1, i1| raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String @experimental_options[i1] = v1 end end when 'ExternalAdminUserSources' @external_admin_user_sources = {} if v.nil? @external_admin_user_sources = {} else v.each do |k1, v1| @external_admin_user_sources[k1] = Comet::ExternalAuthenticationSource.new @external_admin_user_sources[k1].from_hash(v1) end end when 'IPRateLimit' @iprate_limit = Comet::RatelimitOptions.new @iprate_limit.from_hash(v) when 'License' @license = Comet::LicenseOptions.new @license.from_hash(v) when 'ListenAddresses' if v.nil? @listen_addresses = [] else @listen_addresses = Array.new(v.length) v.each_with_index do |v1, i1| @listen_addresses[i1] = Comet::HTTPConnectorOptions.new @listen_addresses[i1].from_hash(v1) end end when 'Organizations' @organizations = {} if v.nil? @organizations = {} else v.each do |k1, v1| @organizations[k1] = Comet::Organization.new @organizations[k1].from_hash(v1) end end when 'PSAConfigs' if v.nil? @psaconfigs = [] else @psaconfigs = Array.new(v.length) v.each_with_index do |v1, i1| @psaconfigs[i1] = Comet::PSAConfig.new @psaconfigs[i1].from_hash(v1) end end when 'SelfBackup' @self_backup = Comet::SelfBackupOptions.new @self_backup.from_hash(v) when 'SessionSettings' @session_settings = Comet::SessionOptions.new @session_settings.from_hash(v) when 'SoftwareBuildRole' @software_build_role = Comet::SoftwareBuildRoleOptions.new @software_build_role.from_hash(v) when 'StorageRole' @storage_role = Comet::StorageRoleOptions.new @storage_role.from_hash(v) when 'TrustXForwardedFor' @trust_xforwarded_for = v when 'WebhookOptions' @webhook_options = {} if v.nil? @webhook_options = {} else v.each do |k1, v1| @webhook_options[k1] = Comet::WebhookOption.new @webhook_options[k1].from_hash(v1) end end else @unknown_json_fields[k] = v end end end |
#from_json(json_string) ⇒ Object
102 103 104 105 106 |
# File 'lib/comet/models/server_config_options.rb', line 102 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_h ⇒ Hash
Returns The complete object as a Ruby hash.
259 260 261 |
# File 'lib/comet/models/server_config_options.rb', line 259 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
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 |
# File 'lib/comet/models/server_config_options.rb', line 227 def to_hash ret = {} ret['AdminUsers'] = @admin_users ret['AuthenticationRole'] = @authentication_role ret['Branding'] = @branding ret['ConstellationRole'] = @constellation_role unless @constellation_role__legacy.nil? ret['OverseerRole'] = @constellation_role__legacy end ret['Email'] = @email unless @experimental_options.nil? ret['ExperimentalOptions'] = @experimental_options end ret['ExternalAdminUserSources'] = @external_admin_user_sources ret['IPRateLimit'] = @iprate_limit ret['License'] = @license ret['ListenAddresses'] = @listen_addresses ret['Organizations'] = @organizations ret['PSAConfigs'] = @psaconfigs ret['SelfBackup'] = @self_backup ret['SessionSettings'] = @session_settings ret['SoftwareBuildRole'] = @software_build_role ret['StorageRole'] = @storage_role ret['TrustXForwardedFor'] = @trust_xforwarded_for ret['WebhookOptions'] = @webhook_options @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.
264 265 266 |
# File 'lib/comet/models/server_config_options.rb', line 264 def to_json( = {}) to_hash.to_json() end |