I learning ruby and playing it with restsclient I have following test the code and I'm expecting that to return 1/false. I can't seem to make it work.
n@lap-jta102:~/tsamcode$ ./get.rb
n@lap-jta102:~/tsamcode$ echo $?
0
#!/usr/bin/env ruby
require 'rest_client'
require 'json'
begin
response = RestClient.get("https://admin:[email protected]/isam/host_records/187.0.0.1/hostnames", :content_type => :json, :accept => :json)
return true if response.code == 200
rescue => e
return false unless response != 200
end