Class: Ayadn::CheckNiceRank

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



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/ayadn/diagnostics.rb', line 90

def check
  begin
    @status.say_header "checking NiceRank server response"
    get_response "http://api.nice.social/user/nicerank?ids=1"
    check_response_code
    ratelimit = @response.headers[:x_ratelimit_remaining]
    if ratelimit.blank?
      @status.say_red :ratelimit, "invalid server response"
    else
      Integer(ratelimit) > 120 ? @status.say_green(:ratelimit, "OK") : @status.say_red(:ratelimit, ratelimit)
    end
  rescue => e
    rescue_network(e)
  end
end