lib/ayadn/nicerank.rb in ayadn-1.4.1 vs lib/ayadn/nicerank.rb in ayadn-1.4.2

- old
+ new

@@ -43,13 +43,19 @@ Debug.how_many_ranks niceranks, get_these unless get_these.empty? got = CNX.get "#{@url}#{get_these.join(',')}&show_details=Y" - unless got.code != 200 - resp = JSON.parse(got) + blank = JSON.parse({'meta' => {'code' => 404}, 'data' => []}.to_json) + if got.nil? || got == "" + parsed = blank else - resp = JSON.parse({'meta' => {'code' => got.code}}.to_json) + parsed = JSON.parse(got) + end + if parsed['meta']['code'] != 200 + resp = blank + else + resp = parsed end if resp['meta']['code'] != 200 Debug.niceranks_error resp Errors.nr "REQUESTED: #{get_these.join(' ')}"