Sha256: 239e23f284869f0fea84451d3c92429c2450985f2dd5a3c5dcbbd16b177c0971

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

class Sysdig::GetAlertNotifications < Sysdig::Request
  def real(from, to)
    from_i, to_i = timestamps(from, to)

    service.request(
      :path   => "/api/notifications",
      :params => {"from" => from_i, "to" => to_i},
    )
  end

  def timestamps(*args)
    args.map { |a| a.to_i * 1_000_000 }
  end

  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sysdig-0.3.1 lib/sysdig/get_alert_notifications.rb
sysdig-0.3.0 lib/sysdig/get_alert_notifications.rb