lib/sumologic.rb in sumologic-0.1.0 vs lib/sumologic.rb in sumologic-0.1.1
- old
+ new
@@ -2,11 +2,11 @@
require 'faraday_middleware'
require 'faraday-cookie_jar'
require 'multi_json'
module SumoLogic
- VERSION = '0.1.0'
+ VERSION = '0.1.1'
URL = 'https://api.sumologic.com/api/v1'
class Client
attr_accessor :http
@@ -21,14 +21,21 @@
conn.response :json, content_type: 'application/json'
conn.adapter Faraday.default_adapter
end
end
+ def post(path, data={})
+ @http.post do |req|
+ req.url path
+ req.body = data unless data.empty?
+ end
+ end
+
def search(query, from_time=nil, to_time=nil, time_zone='UTC')
@http.get do |req|
req.url 'logs/search'
req.params = {q: query, from: from_time, to: to_time, tz: time_zone}
- end
+ end
end
def search_job(query, from_time=nil, to_time=nil, time_zone='UTC')
params = {query: query, from: from_time, to: to_time, timeZone: time_zone}
@http.post do |req|