lib/client.rb in nsisam-0.1.0 vs lib/client.rb in nsisam-0.1.1
- old
+ new
@@ -1,9 +1,11 @@
require "json"
require "net/http"
+require "errors"
module Client
+
class Client
def initialize(url)
user_and_pass = url.match(/(\w+):(\w+)/)
@user, @password = user_and_pass[1], user_and_pass[2]
@@ -47,10 +49,10 @@
def execute_request(request)
response = Net::HTTP.start @url, @port do |http|
http.request(request)
end
+ raise NSISam::Errors::Client::KeyNotFoundError if response.code == "404"
JSON.parse(response.body)
end
-
end
end