Sha256: f6c26a36d3e8427ab38b61a3c6e8faefa3e4e11634da408247a15850fcd8ef2c
Contents?: true
Size: 871 Bytes
Versions: 5
Compression:
Stored size: 871 Bytes
Contents
class Sysdig::UpdateUserNotifications < Sysdig::Request def real(notification) service.request( :method => :put, :path => "/api/settings/notifications", :body => { "userNotification" => notification }, ) end def mock(notification) user_notification = Cistern::Hash.slice(Cistern::Hash.stringify_keys(notification), "sns", "email", "pagerDuty") schema = { "sns" => %w[enabled topics], "email" => %w[enabled recipients], "pagerDuty" => %w[enabled integrated resolveOnOk connectUrl], } sliced = schema.each_with_object({}) { |(type, keys), r| u = user_notification[type] if u r.merge!(type => Cistern::Hash.slice(u, *keys)) end } service.response( :body => { "userNotification" => service.data[:user_notifications].merge!(sliced) }, ) end end
Version data entries
5 entries across 5 versions & 1 rubygems