noticed 1.2.16 → 1.2.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -1
- data/lib/noticed.rb +1 -0
- data/lib/noticed/base.rb +1 -1
- data/lib/noticed/delivery_methods/microsoft_teams.rb +32 -0
- data/lib/noticed/model.rb +4 -0
- data/lib/noticed/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5dc2e5f50621a5b5da4f901c472621c2fce03d5f0f4db7c5a00a42de527e3128
|
4
|
+
data.tar.gz: 1e07d7ea3599b7999d9a252a062ab38641cf6553c8392bf54d70ec9fbc164050
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f2dc0a1735bea8161241f7b384f722fd0a0d5bf1bac80424d63647d39cf9ef727839f3ba8320474c57da327e381daa46c533a788ca7d3ea1978c5eee10dcbfc
|
7
|
+
data.tar.gz: 44eb3c5472b947d416d6f14bb2fa1b6a6d9ed26e853eb5d5ca559c0467c0dea9b83634fb1aac72a691b8fbd7805103e3029562e0800d0f433d2ecd9ab5a4e4d1
|
data/README.md
CHANGED
@@ -12,6 +12,7 @@ Currently, we support these notification delivery methods out of the box:
|
|
12
12
|
* Email
|
13
13
|
* ActionCable channels
|
14
14
|
* Slack
|
15
|
+
* Microsoft Teams
|
15
16
|
* Twilio (SMS)
|
16
17
|
* Vonage / Nexmo (SMS)
|
17
18
|
|
@@ -253,6 +254,42 @@ Sends a Slack notification via webhook.
|
|
253
254
|
|
254
255
|
Defaults to `Rails.application.credentials.slack[:notification_url]`
|
255
256
|
|
257
|
+
### Microsoft Teams
|
258
|
+
|
259
|
+
Sends a Teams notification via webhook.
|
260
|
+
|
261
|
+
`deliver_by :microsoft_teams`
|
262
|
+
|
263
|
+
#### Options
|
264
|
+
|
265
|
+
* `format: :format_for_teams` - *Optional*
|
266
|
+
|
267
|
+
Use a custom method to define the payload sent to slack. Method should return a Hash.
|
268
|
+
Documentation for posting via Webhooks available at: https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook
|
269
|
+
|
270
|
+
```ruby
|
271
|
+
{
|
272
|
+
title: "This is the title for the card",
|
273
|
+
text: "This is the body text for the card",
|
274
|
+
sections: [{activityTitle: "Section Title", activityText: "Section Text"}],
|
275
|
+
"potentialAction": [{
|
276
|
+
"@type": "OpenUri",
|
277
|
+
name: "Button Text",
|
278
|
+
targets: [{
|
279
|
+
os: "default",
|
280
|
+
uri: "https://example.com/foo/action"
|
281
|
+
}]
|
282
|
+
}]
|
283
|
+
|
284
|
+
}
|
285
|
+
```
|
286
|
+
|
287
|
+
* `url: :url_for_teams_channel`: - *Optional*
|
288
|
+
|
289
|
+
Use a custom method to retrieve the MS Teams Webhook URL. Method should return a string.
|
290
|
+
|
291
|
+
Defaults to `Rails.application.credentials.microsoft_teams[:notification_url]`
|
292
|
+
|
256
293
|
### Twilio SMS
|
257
294
|
|
258
295
|
Sends an SMS notification via Twilio.
|
@@ -440,10 +477,11 @@ Convert back into a Noticed notification object:
|
|
440
477
|
@notification.to_notification
|
441
478
|
```
|
442
479
|
|
443
|
-
Mark notification as read:
|
480
|
+
Mark notification as read / unread:
|
444
481
|
|
445
482
|
```ruby
|
446
483
|
@notification.mark_as_read!
|
484
|
+
@notification.mark_as_unread!
|
447
485
|
```
|
448
486
|
|
449
487
|
Check if read / unread:
|
data/lib/noticed.rb
CHANGED
@@ -16,6 +16,7 @@ module Noticed
|
|
16
16
|
autoload :Database, "noticed/delivery_methods/database"
|
17
17
|
autoload :Email, "noticed/delivery_methods/email"
|
18
18
|
autoload :Slack, "noticed/delivery_methods/slack"
|
19
|
+
autoload :MicrosoftTeams, "noticed/delivery_methods/microsoft_teams"
|
19
20
|
autoload :Test, "noticed/delivery_methods/test"
|
20
21
|
autoload :Twilio, "noticed/delivery_methods/twilio"
|
21
22
|
autoload :Vonage, "noticed/delivery_methods/vonage"
|
data/lib/noticed/base.rb
CHANGED
@@ -0,0 +1,32 @@
|
|
1
|
+
module Noticed
|
2
|
+
module DeliveryMethods
|
3
|
+
class MicrosoftTeams < Base
|
4
|
+
def deliver
|
5
|
+
post(url, json: format)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def format
|
11
|
+
if (method = options[:format])
|
12
|
+
notification.send(method)
|
13
|
+
else
|
14
|
+
{
|
15
|
+
title: notification.params[:title],
|
16
|
+
text: notification.params[:text],
|
17
|
+
sections: notification.params[:sections],
|
18
|
+
potentialAction: notification.params[:notification_action]
|
19
|
+
}
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def url
|
24
|
+
if (method = options[:url])
|
25
|
+
notification.send(method)
|
26
|
+
else
|
27
|
+
Rails.application.credentials.microsoft_teams[:notification_url]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/noticed/model.rb
CHANGED
data/lib/noticed/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: noticed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- lib/noticed/delivery_methods/base.rb
|
105
105
|
- lib/noticed/delivery_methods/database.rb
|
106
106
|
- lib/noticed/delivery_methods/email.rb
|
107
|
+
- lib/noticed/delivery_methods/microsoft_teams.rb
|
107
108
|
- lib/noticed/delivery_methods/slack.rb
|
108
109
|
- lib/noticed/delivery_methods/test.rb
|
109
110
|
- lib/noticed/delivery_methods/twilio.rb
|