lib/app_monit/query.rb in app_monit-0.0.7 vs lib/app_monit/query.rb in app_monit-0.0.8
- old
+ new
@@ -7,11 +7,10 @@
end
end
def query(method_name, collection_name, params)
require 'cgi'
- path = "/v1/queries/#{method_name}"
params[:event_collection] = collection_name
query_string_parts = []
@@ -19,9 +18,12 @@
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('&')
+
+ version = params[:version] || Config.version
+ path = "/#{version}/queries/#{method_name}"
response = Http.get("#{path}?#{query_string}")
case response.code.to_i
when 200
JSON.parse(response.body)