class Ayadn::CheckNiceRank

Public Instance Methods

check() click to toggle source
# 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