lib/sysdig/get_alerts.rb in sysdig-0.1.0 vs lib/sysdig/get_alerts.rb in sysdig-0.2.0
- old
+ new
@@ -1,8 +1,27 @@
class Sysdig::GetAlerts < Sysdig::Request
- def real(params={})
+ def real(from: nil, to: nil)
+ params = {}
+
+ if from
+ params.merge!(from.to_i * 1_000_000)
+ end
+
+ if to
+ params.merge!(to.to_i * 1_000_000)
+ end
+
service.request(
:method => :get,
:path => "/api/alerts",
+ :params => params,
+ )
+ end
+
+ def mock(from: nil, to: nil)
+ alerts = service.data[:alerts].values
+
+ service.response(
+ :body => { "alerts" => alerts },
)
end
end