7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/cpaas-sdk/resources/notification_channel.rb', line 7
def self.create_channel(params)
options = {
body: {
notificationChannel: {
channelData: {
'x-webhookURL': params[:webhook_url]
},
channelType: 'webhooks',
clientCorrelator: Cpaas.api.client_correlator
}
}
}
response = Cpaas.api.send_request("#{base_url}/channels", options, :post)
process_response(response) do |res|
channel = res.dig(:notification_channel)
{
channel_id: channel[:callback_url],
webhook_url: channel[:channel_data][:x_webhook_url],
channel_type: channel[:channel_type]
}
end
end
|