Class: KeytechKit::Serverinfo

Inherits:
Object
  • Object
show all
Defined in:
lib/keytechKit/serverinfo.rb

Overview

Provides information about current keytech server Read the full response for raw server data or use the well named accessors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result_data) ⇒ Serverinfo

Returns a new instance of Serverinfo.



15
16
17
# File 'lib/keytechKit/serverinfo.rb', line 15

def initialize(result_data)
  parse_response(result_data)
end

Instance Attribute Details

#allow_status_changeObject

Returns the value of attribute allow_status_change.



13
14
15
# File 'lib/keytechKit/serverinfo.rb', line 13

def allow_status_change
  @allow_status_change
end

#api_versionObject

Returns the value of attribute api_version.



10
11
12
# File 'lib/keytechKit/serverinfo.rb', line 10

def api_version
  @api_version
end

#database_versionObject

Returns the value of attribute database_version.



9
10
11
# File 'lib/keytechKit/serverinfo.rb', line 9

def database_version
  @database_version
end

#descriptionObject

Returns the value of attribute description.



8
9
10
# File 'lib/keytechKit/serverinfo.rb', line 8

def description
  @description
end

#responseObject

Returns the value of attribute response.



6
7
8
# File 'lib/keytechKit/serverinfo.rb', line 6

def response
  @response
end

#server_idObject

Unique ServerID this ID is unique for every installation



12
13
14
# File 'lib/keytechKit/serverinfo.rb', line 12

def server_id
  @server_id
end

Instance Method Details

#parse_response(result_data) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/keytechKit/serverinfo.rb', line 19

def parse_response(result_data)

  self.response = result_data

  result = result_data
  result.each do |kv|
    case kv['Key']
    when 'Server Description' then self.description = kv['Value']
    when 'keytech database version' then self.database_version = kv['Value']
    when 'API version' then self.api_version = kv['Value']
    when 'ServerID' then self.server_id = kv['Value']
    when 'AllowStatusChange' then self.allow_status_change = kv['Value']

      # More fields
    end
  end
end