Class: Ayadn::CheckADN

Inherits:
CheckBase show all
Defined in:
lib/ayadn/diagnostics.rb

Instance Attribute Summary

Attributes inherited from CheckBase

#baseURL, #response, #status

Instance Method Summary collapse

Methods inherited from CheckBase

#check_response_code, #get_response, #initialize, #rescue_network

Constructor Details

This class inherits a constructor from Ayadn::CheckBase

Instance Method Details

#checkObject



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/ayadn/diagnostics.rb', line 109

def check
  begin
    check_root_api
    @status.say_header "checking ADN server response"
    get_response "#{@baseURL}/config"
    check_response_code
    body = JSON.parse(@response.body)
    if body.blank? || body["data"].blank?
      @status.say_red(:config, "no data")
    else
      @status.say_green(:config, "OK")
    end
  rescue => e
    rescue_network(e)
  end
end