lib/hieracles/puppetdb/client.rb in hieracles-0.2.2 vs lib/hieracles/puppetdb/client.rb in hieracles-0.3.0

- old
+ new

@@ -22,21 +22,20 @@ self.class.default_options = {:options => options} self.class.connection_adapter(FixSSLConnectionAdapter) end end - def request(endpoint, method = 'get', query = nil, opts = {}) + def request(endpoint, query = nil, method = 'get', opts = {}) ret = send("#{method}_request".to_sym, endpoint, query, opts) if ret.code.to_s() =~ /^[4|5]/ or ret.parsed_response.length < 1 notifications = [ Hieracles::Notification.new('puppetdb', 'No match.', 'error') ] Response.new({}, 0, notifications) else total = ret.headers['X-Records'] if total.nil? total = ret.parsed_response.length end - Response.new(ret.parsed_response, total) end end def get_request(endpoint, query, opts) @@ -49,10 +48,10 @@ filtered_opts['counts-filter'] = JSON.dump(v) else filtered_opts[k.to_s.sub("_", "-")] = v end end - puts path ; puts filtered_opts ; exit(0) + #puts path ; puts filtered_opts ; exit(0) self.class.get(path, query: filtered_opts) else self.class.get(path) end end