Class: KeytechKit::ServerInfoHandler

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/keytechKit/serverinfo_handler.rb

Overview

Serverinfo Handler

Instance Method Summary collapse

Constructor Details

#initialize(keytechkit, base_url) ⇒ ServerInfoHandler

Returns a new instance of ServerInfoHandler.



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

def initialize(keytechkit, base_url)
  self.class.base_uri(base_url)
  @keytechkit = keytechkit
end

Instance Method Details

#loadObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/keytechKit/serverinfo_handler.rb', line 15

def load
  response = self.class.get('/serverinfo')
  if response.success?
    json = JSON.parse(response.body)
  puts json['ServerInfoResult']
    Serverinfo.new(response['ServerInfoResult'])
  else
    raise response.response
  end
end