class Comet::ServerMetaVersionInfo

ServerMetaVersionInfo is a typed class wrapper around the underlying Comet Server API data structure.

Attributes

authentication_role[RW]

@type [Boolean] authentication_role

constellation_role[RW]

@type [Boolean] constellation_role

constellation_role__legacy[RW]

@type [Boolean] constellation_role__legacy

current_time[RW]

@type [Number] current_time

emails_sent_errors[RW]

@type [Number] emails_sent_errors

emails_sent_successfully[RW]

@type [Number] emails_sent_successfully

emails_waiting_in_queue[RW]

@type [Number] emails_waiting_in_queue

experimental_options[RW]

@type [Array<String>] experimental_options

license_valid_until[RW]

@type [Number] license_valid_until

scheduled_email_thread_current_state[RW]
scheduled_email_thread_last_calculate_duration_nanos[RW]
scheduled_email_thread_last_wake_sent_emails[RW]
scheduled_email_thread_last_wake_time[RW]
scheduled_email_thread_waiting_until[RW]
self_backup[RW]

@type [Array<Comet::SelfBackupStatistics>] self_backup

server_license_hash[RW]

@type [String] server_license_hash

server_start_hash[RW]

@type [String] server_start_hash

server_start_time[RW]

@type [Number] server_start_time

software_build_role[RW]

@type [Boolean] software_build_role

storage_role[RW]

@type [Boolean] storage_role

unknown_json_fields[RW]

@type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations

version[RW]

@type [String] version

version_codename[RW]

@type [String] version_codename

Public Class Methods

new() click to toggle source
# File lib/comet/models/server_meta_version_info.rb, line 86
def initialize
  clear
end

Public Instance Methods

clear() click to toggle source
# 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
from_hash(obj) click to toggle source

@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
from_json(json_string) click to toggle source

@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
to_h() click to toggle source

@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
to_hash() click to toggle source

@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
to_json(options = {}) click to toggle source

@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