class Sysdig::GetAlertNotifications

Public Instance Methods

mock(from, to) click to toggle source
# File lib/sysdig/get_alert_notifications.rb, line 15
def mock(from, to)
  from_i, to_i = timestamps(from, to)

  notifications = service.data[:alert_notifications].values.select { |an|
    an["timestamp"] >= from_i && an["timestamp"] <= to_i
  }

  service.response(
    :body => { "notifications" => notifications },
  )
end
real(from, to) click to toggle source
# File lib/sysdig/get_alert_notifications.rb, line 2
def real(from, to)
  from_i, to_i = timestamps(from, to)

  service.request(
    :path   => "/api/notifications",
    :params => {"from" => from_i, "to" => to_i},
  )
end
timestamps(*args) click to toggle source
# File lib/sysdig/get_alert_notifications.rb, line 11
def timestamps(*args)
  args.map { |a| a.to_i * 1_000_000 }
end