lib/glare/client.rb in glare-0.1.2 vs lib/glare/client.rb in glare-0.2.0

- old
+ new

@@ -1,6 +1,7 @@ require 'jsonclient' +require 'glare/api_response' module Glare class Client BASE_URL = 'https://api.cloudflare.com/client/v4'.freeze @@ -12,21 +13,21 @@ @http = JSONClient.new @http.debug_dev = STDERR if ENV['CF_DEBUG'] end def get(query, params) - @http.get(BASE_URL + query, params, @headers) + ApiResponse.new(@http.get(BASE_URL + query, params, @headers)).valid! end def post(query, data) - @http.post(BASE_URL + query, data, @headers) + ApiResponse.new(@http.post(BASE_URL + query, data, @headers)).valid! end def put(query, data) - @http.put(BASE_URL + query, data, @headers) + ApiResponse.new(@http.put(BASE_URL + query, data, @headers)).valid! end def delete(query, params=nil) - @http.delete(BASE_URL + query, params, @headers) + ApiResponse.new(@http.delete(BASE_URL + query, params, @headers)).valid! end end end