-
Notifications
You must be signed in to change notification settings - Fork 1
/
complex_example.rb
executable file
·75 lines (67 loc) · 1.81 KB
/
complex_example.rb
1
2
3
4
5
6
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env ruby
# frozen_string_literal: true
require "msteams_hermes/actions/open_url"
require "msteams_hermes/components/adaptive_card"
require "msteams_hermes/components/text_block"
require "msteams_hermes/components/container"
require "msteams_hermes/components/fact_set"
require "msteams_hermes/message"
YOUR_WEBHOOK_URL = "YOUR_WEBHOOK_URL"
header = MsTeamsHermes::Components::Container.new(
style: MsTeamsHermes::Style::ContainerStyle::WARNING,
items: [
MsTeamsHermes::Components::TextBlock.new(
text: "John Cena",
size: MsTeamsHermes::Style::FontSize::LARGE,
weight: MsTeamsHermes::Style::FontWeight::BOLDER
),
MsTeamsHermes::Components::TextBlock.new(
text: Time.now.strftime("%A, %d %B %Y %H:%M:%S").to_s
)
]
)
description = MsTeamsHermes::Components::TextBlock.new(
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et " \
"dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip " \
"ex ea commodo consequat.",
wrap: true
)
facts = MsTeamsHermes::Components::FactSet.new(
facts: [
{
"title": "Board:",
"value": "Adaptive Card"
},
{
"title": "List:",
"value": "Backlog"
},
{
"title": "Assigned to:",
"value": "John Cena"
},
{
"title": "Due date:",
"value": "Not set"
}
]
)
action = MsTeamsHermes::Actions::OpenUrl.new(
title: "View Website",
url: "https://adaptivecards.io"
)
content = MsTeamsHermes::Components::AdaptiveCard.new(
body: [
header,
MsTeamsHermes::Components::Container.new(
items: [
description,
facts
]
)
],
actions: [
action
]
)
MsTeamsHermes::Message.new(webhook_url: YOUR_WEBHOOK_URL, content:).deliver