lib/app_monit/query.rb in app_monit-0.0.5 vs lib/app_monit/query.rb in app_monit-0.0.6

- old
+ new

@@ -11,10 +11,18 @@ require 'cgi' path = "/v1/queries/#{method_name}" params[:event_collection] = collection_name - response = Http.get("#{path}?query=#{CGI.escape(params.to_json)}") + query_string_parts = [] + + query_string_parts << "api_key=#{params.delete(:api_key)}" if params[:api_key] + query_string_parts << "environment=#{params.delete(:environment)}" if params[:environment] + query_string_parts << "query=#{CGI.escape(params.to_json)}" + + query_string = query_string_parts.join('&') + + response = Http.get("#{path}?#{query_string}") case response.code.to_i when 200 JSON.parse(response.body) else