Class: Sysdig::GetAlerts

Inherits:
Request
  • Object
show all
Defined in:
lib/sysdig/get_alerts.rb

Instance Method Summary collapse

Instance Method Details

#mock(from: nil, to: nil) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/sysdig/get_alerts.rb', line 20

def mock(from: nil, to: nil)
  alerts = service.data[:alerts].values

  service.response(
    :body => { "alerts" => alerts },
  )
end

#real(from: nil, to: nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sysdig/get_alerts.rb', line 2

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