class Comet::ServerMetaVersionInfo
ServerMetaVersionInfo
is a typed class wrapper around the underlying Comet
Server API data structure.
Attributes
@type [Boolean] authentication_role
@type [Boolean] constellation_role
@type [Boolean] constellation_role__legacy
@type [Number] current_time
@type [Number] emails_sent_errors
@type [Number] emails_sent_successfully
@type [Number] emails_waiting_in_queue
@type [Array<String>] experimental_options
@type [Number] license_valid_until
@type [Number] scheduled_email_thread_current_state
@type [Number] scheduled_email_thread_last_calculate_duration_nanos
@type [Boolean] scheduled_email_thread_last_wake_sent_emails
@type [Number] scheduled_email_thread_last_wake_time
@type [Number] scheduled_email_thread_waiting_until
@type [Array<Comet::SelfBackupStatistics>] self_backup
@type [String] server_license_hash
@type [String] server_start_hash
@type [Number] server_start_time
@type [Boolean] software_build_role
@type [Boolean] storage_role
@type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
@type [String] version
@type [String] version_codename
Public Class Methods
# File lib/comet/models/server_meta_version_info.rb, line 86 def initialize clear end
Public Instance Methods
# File lib/comet/models/server_meta_version_info.rb, line 90 def clear @version = '' @version_codename = '' @experimental_options = [] @server_start_time = 0 @server_start_hash = '' @current_time = 0 @server_license_hash = '' @license_valid_until = 0 @emails_sent_successfully = 0 @emails_sent_errors = 0 @emails_waiting_in_queue = 0 @scheduled_email_thread_current_state = 0 @scheduled_email_thread_last_calculate_duration_nanos = 0 @scheduled_email_thread_waiting_until = 0 @scheduled_email_thread_last_wake_time = 0 @self_backup = [] @unknown_json_fields = {} end
@param [Hash] obj The complete object as a Ruby hash
# File lib/comet/models/server_meta_version_info.rb, line 118 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 'Version' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @version = v when 'VersionCodename' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @version_codename = v when 'StorageRole' @storage_role = v when 'AuthenticationRole' @authentication_role = v when 'SoftwareBuildRole' @software_build_role = v when 'OverseerRole' @constellation_role__legacy = v when 'ConstellationRole' @constellation_role = 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 'ServerStartTime' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @server_start_time = v when 'ServerStartHash' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @server_start_hash = v when 'CurrentTime' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @current_time = v when 'ServerLicenseHash' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @server_license_hash = v when 'LicenseValidUntil' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @license_valid_until = v when 'EmailsSentSuccessfully' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @emails_sent_successfully = v when 'EmailsSentErrors' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @emails_sent_errors = v when 'EmailsWaitingInQueue' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @emails_waiting_in_queue = v when 'ScheduledEmailThreadCurrentState' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @scheduled_email_thread_current_state = v when 'ScheduledEmailThreadLastCalculateDurationNanos' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @scheduled_email_thread_last_calculate_duration_nanos = v when 'ScheduledEmailThreadWaitingUntil' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @scheduled_email_thread_waiting_until = v when 'ScheduledEmailThreadLastWakeTime' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @scheduled_email_thread_last_wake_time = v when 'ScheduledEmailThreadLastWakeSentEmails' @scheduled_email_thread_last_wake_sent_emails = v when 'SelfBackup' if v.nil? @self_backup = [] else @self_backup = Array.new(v.length) v.each_with_index do |v1, i1| @self_backup[i1] = Comet::SelfBackupStatistics.new @self_backup[i1].from_hash(v1) end end else @unknown_json_fields[k] = v end end end
@param [String] json_string The complete object in JSON format
# File lib/comet/models/server_meta_version_info.rb, line 111 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
@return [Hash] The complete object as a Ruby hash
# File lib/comet/models/server_meta_version_info.rb, line 252 def to_h to_hash end
@return [Hash] The complete object as a Ruby hash
# File lib/comet/models/server_meta_version_info.rb, line 219 def to_hash ret = {} ret['Version'] = @version ret['VersionCodename'] = @version_codename ret['StorageRole'] = @storage_role ret['AuthenticationRole'] = @authentication_role ret['SoftwareBuildRole'] = @software_build_role ret['OverseerRole'] = @constellation_role__legacy ret['ConstellationRole'] = @constellation_role unless @experimental_options.nil? ret['ExperimentalOptions'] = @experimental_options end ret['ServerStartTime'] = @server_start_time ret['ServerStartHash'] = @server_start_hash ret['CurrentTime'] = @current_time ret['ServerLicenseHash'] = @server_license_hash ret['LicenseValidUntil'] = @license_valid_until ret['EmailsSentSuccessfully'] = @emails_sent_successfully ret['EmailsSentErrors'] = @emails_sent_errors ret['EmailsWaitingInQueue'] = @emails_waiting_in_queue ret['ScheduledEmailThreadCurrentState'] = @scheduled_email_thread_current_state ret['ScheduledEmailThreadLastCalculateDurationNanos'] = @scheduled_email_thread_last_calculate_duration_nanos ret['ScheduledEmailThreadWaitingUntil'] = @scheduled_email_thread_waiting_until ret['ScheduledEmailThreadLastWakeTime'] = @scheduled_email_thread_last_wake_time ret['ScheduledEmailThreadLastWakeSentEmails'] = @scheduled_email_thread_last_wake_sent_emails ret['SelfBackup'] = @self_backup @unknown_json_fields.each do |k, v| ret[k] = v end ret end
@return [String] The complete object as a JSON string
# File lib/comet/models/server_meta_version_info.rb, line 257 def to_json(options = {}) to_hash.to_json(options) end