bas 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/._.rspec_status +0 -0
- data/.rspec +3 -0
- data/.rubocop.yml +14 -0
- data/CHANGELOG.md +4 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/CONTRIBUTING.md +66 -0
- data/Gemfile +24 -0
- data/LICENSE +21 -0
- data/README.md +362 -0
- data/Rakefile +12 -0
- data/SECURITY.md +13 -0
- data/lib/bas/dispatcher/base.rb +31 -0
- data/lib/bas/dispatcher/discord/exceptions/invalid_webhook_token.rb +16 -0
- data/lib/bas/dispatcher/discord/implementation.rb +51 -0
- data/lib/bas/dispatcher/discord/types/response.rb +22 -0
- data/lib/bas/dispatcher/slack/exceptions/invalid_webhook_token.rb +16 -0
- data/lib/bas/dispatcher/slack/implementation.rb +51 -0
- data/lib/bas/dispatcher/slack/types/response.rb +21 -0
- data/lib/bas/domain/birthday.rb +25 -0
- data/lib/bas/domain/email.rb +34 -0
- data/lib/bas/domain/exceptions/function_not_implemented.rb +18 -0
- data/lib/bas/domain/pto.rb +28 -0
- data/lib/bas/domain/work_items_limit.rb +25 -0
- data/lib/bas/fetcher/base.rb +43 -0
- data/lib/bas/fetcher/imap/base.rb +70 -0
- data/lib/bas/fetcher/imap/types/response.rb +27 -0
- data/lib/bas/fetcher/imap/use_case/support_emails.rb +26 -0
- data/lib/bas/fetcher/notion/base.rb +52 -0
- data/lib/bas/fetcher/notion/exceptions/invalid_api_key.rb +15 -0
- data/lib/bas/fetcher/notion/exceptions/invalid_database_id.rb +15 -0
- data/lib/bas/fetcher/notion/helper.rb +21 -0
- data/lib/bas/fetcher/notion/types/response.rb +26 -0
- data/lib/bas/fetcher/notion/use_case/birthday_next_week.rb +41 -0
- data/lib/bas/fetcher/notion/use_case/birthday_today.rb +29 -0
- data/lib/bas/fetcher/notion/use_case/pto_next_week.rb +71 -0
- data/lib/bas/fetcher/notion/use_case/pto_today.rb +30 -0
- data/lib/bas/fetcher/notion/use_case/work_items_limit.rb +37 -0
- data/lib/bas/fetcher/postgres/base.rb +46 -0
- data/lib/bas/fetcher/postgres/helper.rb +16 -0
- data/lib/bas/fetcher/postgres/types/response.rb +42 -0
- data/lib/bas/fetcher/postgres/use_case/pto_today.rb +32 -0
- data/lib/bas/formatter/base.rb +53 -0
- data/lib/bas/formatter/birthday.rb +34 -0
- data/lib/bas/formatter/exceptions/invalid_data.rb +15 -0
- data/lib/bas/formatter/pto.rb +88 -0
- data/lib/bas/formatter/support_emails.rb +69 -0
- data/lib/bas/formatter/work_items_limit.rb +64 -0
- data/lib/bas/mapper/base.rb +30 -0
- data/lib/bas/mapper/imap/support_emails.rb +56 -0
- data/lib/bas/mapper/notion/birthday_today.rb +68 -0
- data/lib/bas/mapper/notion/pto_today.rb +70 -0
- data/lib/bas/mapper/notion/work_items_limit.rb +65 -0
- data/lib/bas/mapper/postgres/pto_today.rb +47 -0
- data/lib/bas/use_cases/types/config.rb +19 -0
- data/lib/bas/use_cases/use_case.rb +39 -0
- data/lib/bas/use_cases/use_cases.rb +377 -0
- data/lib/bas/version.rb +6 -0
- data/lib/bas.rb +9 -0
- data/renovate.json +6 -0
- data/sig/business_automation_system.rbs +4 -0
- metadata +107 -0
@@ -0,0 +1,377 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# fetcher
|
4
|
+
require_relative "../fetcher/notion/use_case/birthday_today"
|
5
|
+
require_relative "../fetcher/notion/use_case/birthday_next_week"
|
6
|
+
require_relative "../fetcher/notion/use_case/pto_today"
|
7
|
+
require_relative "../fetcher/notion/use_case/pto_next_week"
|
8
|
+
require_relative "../fetcher/notion/use_case/work_items_limit"
|
9
|
+
require_relative "../fetcher/postgres/use_case/pto_today"
|
10
|
+
require_relative "../fetcher/imap/use_case/support_emails"
|
11
|
+
|
12
|
+
# mapper
|
13
|
+
require_relative "../mapper/notion/birthday_today"
|
14
|
+
require_relative "../mapper/notion/pto_today"
|
15
|
+
require_relative "../mapper/notion/work_items_limit"
|
16
|
+
require_relative "../mapper/postgres/pto_today"
|
17
|
+
require_relative "../mapper/imap/support_emails"
|
18
|
+
|
19
|
+
# formatter
|
20
|
+
require_relative "../formatter/birthday"
|
21
|
+
require_relative "../formatter/pto"
|
22
|
+
require_relative "../formatter/work_items_limit"
|
23
|
+
require_relative "../formatter/support_emails"
|
24
|
+
|
25
|
+
# dispatcher
|
26
|
+
require_relative "../dispatcher/discord/implementation"
|
27
|
+
require_relative "../dispatcher/slack/implementation"
|
28
|
+
|
29
|
+
require_relative "use_case"
|
30
|
+
require_relative "./types/config"
|
31
|
+
|
32
|
+
##
|
33
|
+
# This module provides factory methods for use cases within the system. Each method
|
34
|
+
# represents a use case implementation introduced in the system.
|
35
|
+
#
|
36
|
+
module UseCases
|
37
|
+
# Provides an instance of the Birthdays notifications from Notion to Discord use case implementation.
|
38
|
+
#
|
39
|
+
# <b>Example</b>
|
40
|
+
#
|
41
|
+
# options = {
|
42
|
+
# fetch_options: {
|
43
|
+
# database_id: NOTION_DATABASE_ID,
|
44
|
+
# secret: NOTION_API_INTEGRATION_SECRET,
|
45
|
+
# },
|
46
|
+
# dispatch_options: {
|
47
|
+
# webhook: "https://discord.com/api/webhooks/1199213527672565760/KmpoIzBet9xYG16oFh8W1RWHbpIqT7UtTBRrhfLcvWZdNiVZCTM-gpil2Qoy4eYEgpdf",
|
48
|
+
# name: "Birthday Bot"
|
49
|
+
# }
|
50
|
+
# }
|
51
|
+
#
|
52
|
+
# use_case = UseCases.notify_birthday_from_notion_to_discord(options)
|
53
|
+
# use_case.perform
|
54
|
+
#
|
55
|
+
# #################################################################################
|
56
|
+
#
|
57
|
+
# Requirements:
|
58
|
+
# * Notion database ID, from a database with the following structure:
|
59
|
+
#
|
60
|
+
# _________________________________________________________________________________
|
61
|
+
# | Complete Name (text) | BD_this_year (formula) | BD (date) |
|
62
|
+
# | -------------------- | --------------------------- | ------------------------ |
|
63
|
+
# | John Doe | January 24, 2024 | January 24, 2000 |
|
64
|
+
# | Jane Doe | June 20, 2024 | June 20, 2000 |
|
65
|
+
# ---------------------------------------------------------------------------------
|
66
|
+
# With the following formula for the BD_this_year column:
|
67
|
+
# dateAdd(prop("BD"), year(now()) - year(prop("BD")), "years")
|
68
|
+
#
|
69
|
+
# * A Notion secret, which can be obtained, by creating an integration here: `https://developers.notion.com/`,
|
70
|
+
# browsing on the <View my integations> option, and selecting the <New Integration> or <Create new>
|
71
|
+
# integration** buttons.
|
72
|
+
# * A webhook key, which can be generated directly on discrod on the desired channel, following this instructions:
|
73
|
+
# https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
|
74
|
+
#
|
75
|
+
def self.notify_birthday_from_notion_to_discord(options)
|
76
|
+
fetcher = Fetcher::Notion::BirthdayToday.new(options[:fetch_options])
|
77
|
+
mapper = Mapper::Notion::BirthdayToday.new
|
78
|
+
formatter = Formatter::Birthday.new(options[:format_options])
|
79
|
+
dispatcher = Dispatcher::Discord::Implementation.new(options[:dispatch_options])
|
80
|
+
use_case_config = UseCases::Types::Config.new(fetcher, mapper, formatter, dispatcher)
|
81
|
+
|
82
|
+
UseCases::UseCase.new(use_case_config)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Provides an instance of the next week Birthdays notifications from Notion to Discord use case implementation.
|
86
|
+
#
|
87
|
+
# <b>Example</b>
|
88
|
+
#
|
89
|
+
# options = {
|
90
|
+
# fetch_options: {
|
91
|
+
# database_id: NOTION_DATABASE_ID,
|
92
|
+
# secret: NOTION_API_INTEGRATION_SECRET,
|
93
|
+
# },
|
94
|
+
# dispatch_options: {
|
95
|
+
# webhook: "https://discord.com/api/webhooks/1199213527672565760/KmpoIzBet9xYG16oFh8W1RWHbpIqT7UtTBRrhfLcvWZdNiVZCTM-gpil2Qoy4eYEgpdf",
|
96
|
+
# name: "Birthday Bot"
|
97
|
+
# },
|
98
|
+
# format_options: {
|
99
|
+
# template: "individual_name, Wishing you a very happy birthday! Enjoy your special day! :birthday: :gift:",
|
100
|
+
# timezone: "-05:00"
|
101
|
+
# }
|
102
|
+
# }
|
103
|
+
#
|
104
|
+
# use_case = UseCases.notify_next_week_birthday_from_notion_to_discord(options)
|
105
|
+
# use_case.perform
|
106
|
+
#
|
107
|
+
# #################################################################################
|
108
|
+
#
|
109
|
+
# Requirements:
|
110
|
+
# * Notion database ID, from a database with the following structure:
|
111
|
+
#
|
112
|
+
# _________________________________________________________________________________
|
113
|
+
# | Complete Name (text) | BD_this_year (formula) | BD (date) |
|
114
|
+
# | -------------------- | --------------------------- | ------------------------ |
|
115
|
+
# | John Doe | January 24, 2024 | January 24, 2000 |
|
116
|
+
# | Jane Doe | June 20, 2024 | June 20, 2000 |
|
117
|
+
# ---------------------------------------------------------------------------------
|
118
|
+
# With the following formula for the BD_this_year column:
|
119
|
+
# dateAdd(prop("BD"), year(now()) - year(prop("BD")), "years")
|
120
|
+
#
|
121
|
+
# * A Notion secret, which can be obtained, by creating an integration here: `https://developers.notion.com/`,
|
122
|
+
# browsing on the <View my integations> option, and selecting the <New Integration> or <Create new>
|
123
|
+
# integration** buttons.
|
124
|
+
# * A webhook key, which can be generated directly on discrod on the desired channel, following this instructions:
|
125
|
+
# https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
|
126
|
+
#
|
127
|
+
def self.notify_next_week_birthday_from_notion_to_discord(options)
|
128
|
+
fetcher = Fetcher::Notion::BirthdayNextWeek.new(options[:fetch_options])
|
129
|
+
mapper = Mapper::Notion::BirthdayToday.new
|
130
|
+
formatter = Formatter::Birthday.new(options[:format_options])
|
131
|
+
dispatcher = Dispatcher::Discord::Implementation.new(options[:dispatch_options])
|
132
|
+
use_case_cofig = UseCases::Types::Config.new(fetcher, mapper, formatter, dispatcher)
|
133
|
+
|
134
|
+
UseCases::UseCase.new(use_case_cofig)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Provides an instance of the PTO notifications from Notion to Discord use case implementation.
|
138
|
+
#
|
139
|
+
# <br>
|
140
|
+
# <b>Example</b>
|
141
|
+
#
|
142
|
+
# options = {
|
143
|
+
# fetch_options: {
|
144
|
+
# database_id: NOTION_DATABASE_ID,
|
145
|
+
# secret: NOTION_API_INTEGRATION_SECRET,
|
146
|
+
# },
|
147
|
+
# dispatch_options: {
|
148
|
+
# webhook: "https://discord.com/api/webhooks/1199213527672565760/KmpoIzBet9xYG16oFh8W1RWHbpIqT7UtTBRrhfLcvWZdNiVZCTM-gpil2Qoy4eYEgpdf",
|
149
|
+
# name: "Pto Bot"
|
150
|
+
# }
|
151
|
+
# }
|
152
|
+
#
|
153
|
+
# use_case = UseCases.notify_pto_from_notion_to_discord(options)
|
154
|
+
# use_case.perform
|
155
|
+
#
|
156
|
+
# #################################################################################
|
157
|
+
#
|
158
|
+
# Requirements:
|
159
|
+
# * Notion database ID, from a database with the following structure:
|
160
|
+
#
|
161
|
+
# ________________________________________________________________________________________________________
|
162
|
+
# | Person (person) | Desde? (date) | Hasta? (date) |
|
163
|
+
# | -------------------- | --------------------------------------- | ------------------------------------ |
|
164
|
+
# | John Doe | January 24, 2024 | January 27, 2024 |
|
165
|
+
# | Jane Doe | November 11, 2024 2:00 PM | November 11, 2024 6:00 PM |
|
166
|
+
# ---------------------------------------------------------------------------------------------------------
|
167
|
+
#
|
168
|
+
# * A Notion secret, which can be obtained, by creating an integration here: `https://developers.notion.com/`,
|
169
|
+
# browsing on the <View my integations> option, and selecting the <New Integration> or <Create new>
|
170
|
+
# integration** buttons.
|
171
|
+
# * A webhook key, which can be generated directly on discrod on the desired channel, following this instructions:
|
172
|
+
# https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
|
173
|
+
#
|
174
|
+
def self.notify_pto_from_notion_to_discord(options)
|
175
|
+
fetcher = Fetcher::Notion::PtoToday.new(options[:fetch_options])
|
176
|
+
mapper = Mapper::Notion::PtoToday.new
|
177
|
+
formatter = Formatter::Pto.new(options[:format_options])
|
178
|
+
dispatcher = Dispatcher::Discord::Implementation.new(options[:dispatch_options])
|
179
|
+
use_case_config = UseCases::Types::Config.new(fetcher, mapper, formatter, dispatcher)
|
180
|
+
|
181
|
+
UseCases::UseCase.new(use_case_config)
|
182
|
+
end
|
183
|
+
|
184
|
+
# Provides an instance of the next week PTO notifications from Notion to Discord use case implementation.
|
185
|
+
#
|
186
|
+
# <br>
|
187
|
+
# <b>Example</b>
|
188
|
+
#
|
189
|
+
# options = {
|
190
|
+
# fetch_options: {
|
191
|
+
# database_id: NOTION_DATABASE_ID,
|
192
|
+
# secret: NOTION_API_INTEGRATION_SECRET,
|
193
|
+
# },
|
194
|
+
# dispatch_options: {
|
195
|
+
# webhook: "https://discord.com/api/webhooks/1199213527672565760/KmpoIzBet9xYG16oFh8W1RWHbpIqT7UtTBRrhfLcvWZdNiVZCTM-gpil2Qoy4eYEgpdf",
|
196
|
+
# name: "Pto Bot"
|
197
|
+
# },
|
198
|
+
# format_options: {
|
199
|
+
# template: ":beach: individual_name its going to be on PTO next week,",
|
200
|
+
# timezone: "-05:00"
|
201
|
+
# }
|
202
|
+
# }
|
203
|
+
#
|
204
|
+
# use_case = UseCases.notify_next_week_pto_from_notion_to_discord(options)
|
205
|
+
# use_case.perform
|
206
|
+
#
|
207
|
+
# #################################################################################
|
208
|
+
#
|
209
|
+
# Requirements:
|
210
|
+
# * Notion database ID, from a database with the following structure:
|
211
|
+
#
|
212
|
+
# ________________________________________________________________________________________________________
|
213
|
+
# | Person (person) | Desde? (date) | Hasta? (date) |
|
214
|
+
# | -------------------- | --------------------------------------- | ------------------------------------ |
|
215
|
+
# | John Doe | January 24, 2024 | January 27, 2024 |
|
216
|
+
# | Jane Doe | November 11, 2024 2:00 PM | November 11, 2024 6:00 PM |
|
217
|
+
# ---------------------------------------------------------------------------------------------------------
|
218
|
+
#
|
219
|
+
# * A Notion secret, which can be obtained, by creating an integration here: `https://developers.notion.com/`,
|
220
|
+
# browsing on the <View my integations> option, and selecting the <New Integration> or <Create new>
|
221
|
+
# integration** buttons.
|
222
|
+
# * A webhook key, which can be generated directly on discrod on the desired channel, following this instructions:
|
223
|
+
# https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
|
224
|
+
#
|
225
|
+
def self.notify_next_week_pto_from_notion_to_discord(options)
|
226
|
+
fetcher = Fetcher::Notion::PtoNextWeek.new(options[:fetch_options])
|
227
|
+
mapper = Mapper::Notion::PtoToday.new
|
228
|
+
formatter = Formatter::Pto.new(options[:format_options])
|
229
|
+
dispatcher = Dispatcher::Discord::Implementation.new(options[:dispatch_options])
|
230
|
+
use_case_config = UseCases::Types::Config.new(fetcher, mapper, formatter, dispatcher)
|
231
|
+
|
232
|
+
UseCases::UseCase.new(use_case_config)
|
233
|
+
end
|
234
|
+
|
235
|
+
# Provides an instance of the PTO notifications from Postgres to Slack use case implementation.
|
236
|
+
#
|
237
|
+
# <br>
|
238
|
+
# <b>Example</b>
|
239
|
+
#
|
240
|
+
# options = {
|
241
|
+
# fetch_options: {
|
242
|
+
# connection: {
|
243
|
+
# host: "localhost",
|
244
|
+
# port: 5432,
|
245
|
+
# dbname: "db_pto",
|
246
|
+
# user: "postgres",
|
247
|
+
# password: "postgres"
|
248
|
+
# }
|
249
|
+
# },
|
250
|
+
# dispatch_options:{
|
251
|
+
# webhook: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
|
252
|
+
# name: "Pto Bot"
|
253
|
+
# },
|
254
|
+
# format_options: {
|
255
|
+
# template: "Custom template",
|
256
|
+
# timezone: "-05:00"
|
257
|
+
# }
|
258
|
+
# }
|
259
|
+
#
|
260
|
+
# use_case = UseCases.notify_pto_from_postgres_to_slack(options)
|
261
|
+
# use_case.perform
|
262
|
+
#
|
263
|
+
# #################################################################################
|
264
|
+
#
|
265
|
+
# Requirements:
|
266
|
+
# * A connection to a Postgres database and a table with the following structure:
|
267
|
+
#
|
268
|
+
# Column | Type | Collation | Nullable | Default
|
269
|
+
# -----------------+------------------------+-----------+----------+------------------------------
|
270
|
+
# id | integer | | not null | generated always as identity
|
271
|
+
# create_time | date | | |
|
272
|
+
# individual_name | character varying(255) | | |
|
273
|
+
# start_date | date | | |
|
274
|
+
# end_date | date | | |
|
275
|
+
#
|
276
|
+
# * A webhook key, which can be generated directly on slack on the desired channel, following this instructions:
|
277
|
+
# https://api.slack.com/messaging/webhooks#create_a_webhook
|
278
|
+
#
|
279
|
+
def self.notify_pto_from_postgres_to_slack(options)
|
280
|
+
fetcher = Fetcher::Postgres::PtoToday.new(options[:fetch_options])
|
281
|
+
mapper = Mapper::Postgres::PtoToday.new
|
282
|
+
formatter = Formatter::Pto.new(options[:format_options])
|
283
|
+
dispatcher = Dispatcher::Slack::Implementation.new(options[:dispatch_options])
|
284
|
+
use_case_config = UseCases::Types::Config.new(fetcher, mapper, formatter, dispatcher)
|
285
|
+
|
286
|
+
UseCases::UseCase.new(use_case_config)
|
287
|
+
end
|
288
|
+
|
289
|
+
# Provides an instance of the Work Items wip limit notifications from Notion to Discord use case implementation.
|
290
|
+
#
|
291
|
+
# <br>
|
292
|
+
# <b>Example</b>
|
293
|
+
#
|
294
|
+
# options = {
|
295
|
+
# fetch_options: {
|
296
|
+
# database_id: NOTION_DATABASE_ID,
|
297
|
+
# secret: NOTION_API_INTEGRATION_SECRET
|
298
|
+
# },
|
299
|
+
# dispatch_options: {
|
300
|
+
# webhook: "https://discord.com/api/webhooks/1199213527672565760/KmpoIzBet9xYG16oFh8W1RWHbpIqT7UtTBRrhfLcvWZdNiVZCTM-gpil2Qoy4eYEgpdf",
|
301
|
+
# name: "wipLimit"
|
302
|
+
# }
|
303
|
+
# }
|
304
|
+
#
|
305
|
+
# use_case = UseCases.notify_wip_limit_from_notion_to_discord(options)
|
306
|
+
# use_case.perform
|
307
|
+
#
|
308
|
+
# #################################################################################
|
309
|
+
#
|
310
|
+
# Requirements:
|
311
|
+
# * Notion database ID, from a database with the following structure:
|
312
|
+
#
|
313
|
+
# _________________________________________________________________________________
|
314
|
+
# | OK | Status | Responsible Domain |
|
315
|
+
# | -------------------- | --------------------------- | ------------------------ |
|
316
|
+
# | ✅ | In Progress | "kommit.admin" |
|
317
|
+
# | 🚩 | Fail | "kommit.ops" |
|
318
|
+
# ---------------------------------------------------------------------------------
|
319
|
+
#
|
320
|
+
# * A Notion secret, which can be obtained, by creating an integration here: `https://developers.notion.com/`,
|
321
|
+
# browsing on the <View my integations> option, and selecting the <New Integration> or <Create new>
|
322
|
+
# integration** buttons.
|
323
|
+
# * A webhook key, which can be generated directly on discrod on the desired channel, following this instructions:
|
324
|
+
# https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
|
325
|
+
#
|
326
|
+
def self.notify_wip_limit_from_notion_to_discord(options)
|
327
|
+
fetcher = Fetcher::Notion::WorkItemsLimit.new(options[:fetch_options])
|
328
|
+
mapper = Mapper::Notion::WorkItemsLimit.new
|
329
|
+
formatter = Formatter::WorkItemsLimit.new(options[:format_options])
|
330
|
+
dispatcher = Dispatcher::Discord::Implementation.new(options[:dispatch_options])
|
331
|
+
use_case_config = UseCases::Types::Config.new(fetcher, mapper, formatter, dispatcher)
|
332
|
+
|
333
|
+
UseCases::UseCase.new(use_case_config)
|
334
|
+
end
|
335
|
+
|
336
|
+
# Provides an instance of the support emails from an google IMAP server to Discord use case implementation.
|
337
|
+
#
|
338
|
+
# <br>
|
339
|
+
# <b>Example</b>
|
340
|
+
#
|
341
|
+
# options = {
|
342
|
+
# fetch_options: {
|
343
|
+
# user: 'info@email.co',
|
344
|
+
# refresh_token: REFRESH_TOKEN,
|
345
|
+
# client_id: CLIENT_ID,
|
346
|
+
# client_secret: CLIENT_SECRET,
|
347
|
+
# inbox: 'INBOX',
|
348
|
+
# search_email: 'support@email.co'
|
349
|
+
# },
|
350
|
+
# dispatch_options: {
|
351
|
+
# webhook: "https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
|
352
|
+
# name: "emailSupport"
|
353
|
+
# }
|
354
|
+
# }
|
355
|
+
#
|
356
|
+
# use_case = UseCases.notify_support_email_from_imap_to_discord(options)
|
357
|
+
# use_case.perform
|
358
|
+
#
|
359
|
+
# #################################################################################
|
360
|
+
#
|
361
|
+
# Requirements:
|
362
|
+
# * A google gmail account with IMAP support activated.
|
363
|
+
# * A set of authorization parameters like a client_id, client_secret, and a resfresh_token. To
|
364
|
+
# generate them, follow this instructions: https://developers.google.com/identity/protocols/oauth2
|
365
|
+
# * A webhook key, which can be generated directly on discrod on the desired channel, following this instructions:
|
366
|
+
# https://support.discord.com/hc/en-us/articles/228383668-Intro-to-Webhooks
|
367
|
+
#
|
368
|
+
def self.notify_support_email_from_imap_to_discord(options)
|
369
|
+
fetcher = Fetcher::Imap::SupportEmails.new(options[:fetch_options])
|
370
|
+
mapper = Mapper::Imap::SupportEmails.new
|
371
|
+
formatter = Formatter::SupportEmails.new(options[:format_options])
|
372
|
+
dispatcher = Dispatcher::Discord::Implementation.new(options[:dispatch_options])
|
373
|
+
use_case_config = UseCases::Types::Config.new(fetcher, mapper, formatter, dispatcher)
|
374
|
+
|
375
|
+
UseCases::UseCase.new(use_case_config)
|
376
|
+
end
|
377
|
+
end
|
data/lib/bas/version.rb
ADDED
data/lib/bas.rb
ADDED
data/renovate.json
ADDED
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bas
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- kommitters Open Source
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A versatile business automation system offering key components for building
|
14
|
+
various use cases. It provides an easy-to-use tool for implementing automation
|
15
|
+
workflows without excessive complexity. Formerly known as 'bns'.
|
16
|
+
email:
|
17
|
+
- oss@kommit.co
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- "._.rspec_status"
|
23
|
+
- ".rspec"
|
24
|
+
- ".rubocop.yml"
|
25
|
+
- CHANGELOG.md
|
26
|
+
- CODE_OF_CONDUCT.md
|
27
|
+
- CONTRIBUTING.md
|
28
|
+
- Gemfile
|
29
|
+
- LICENSE
|
30
|
+
- README.md
|
31
|
+
- Rakefile
|
32
|
+
- SECURITY.md
|
33
|
+
- lib/bas.rb
|
34
|
+
- lib/bas/dispatcher/base.rb
|
35
|
+
- lib/bas/dispatcher/discord/exceptions/invalid_webhook_token.rb
|
36
|
+
- lib/bas/dispatcher/discord/implementation.rb
|
37
|
+
- lib/bas/dispatcher/discord/types/response.rb
|
38
|
+
- lib/bas/dispatcher/slack/exceptions/invalid_webhook_token.rb
|
39
|
+
- lib/bas/dispatcher/slack/implementation.rb
|
40
|
+
- lib/bas/dispatcher/slack/types/response.rb
|
41
|
+
- lib/bas/domain/birthday.rb
|
42
|
+
- lib/bas/domain/email.rb
|
43
|
+
- lib/bas/domain/exceptions/function_not_implemented.rb
|
44
|
+
- lib/bas/domain/pto.rb
|
45
|
+
- lib/bas/domain/work_items_limit.rb
|
46
|
+
- lib/bas/fetcher/base.rb
|
47
|
+
- lib/bas/fetcher/imap/base.rb
|
48
|
+
- lib/bas/fetcher/imap/types/response.rb
|
49
|
+
- lib/bas/fetcher/imap/use_case/support_emails.rb
|
50
|
+
- lib/bas/fetcher/notion/base.rb
|
51
|
+
- lib/bas/fetcher/notion/exceptions/invalid_api_key.rb
|
52
|
+
- lib/bas/fetcher/notion/exceptions/invalid_database_id.rb
|
53
|
+
- lib/bas/fetcher/notion/helper.rb
|
54
|
+
- lib/bas/fetcher/notion/types/response.rb
|
55
|
+
- lib/bas/fetcher/notion/use_case/birthday_next_week.rb
|
56
|
+
- lib/bas/fetcher/notion/use_case/birthday_today.rb
|
57
|
+
- lib/bas/fetcher/notion/use_case/pto_next_week.rb
|
58
|
+
- lib/bas/fetcher/notion/use_case/pto_today.rb
|
59
|
+
- lib/bas/fetcher/notion/use_case/work_items_limit.rb
|
60
|
+
- lib/bas/fetcher/postgres/base.rb
|
61
|
+
- lib/bas/fetcher/postgres/helper.rb
|
62
|
+
- lib/bas/fetcher/postgres/types/response.rb
|
63
|
+
- lib/bas/fetcher/postgres/use_case/pto_today.rb
|
64
|
+
- lib/bas/formatter/base.rb
|
65
|
+
- lib/bas/formatter/birthday.rb
|
66
|
+
- lib/bas/formatter/exceptions/invalid_data.rb
|
67
|
+
- lib/bas/formatter/pto.rb
|
68
|
+
- lib/bas/formatter/support_emails.rb
|
69
|
+
- lib/bas/formatter/work_items_limit.rb
|
70
|
+
- lib/bas/mapper/base.rb
|
71
|
+
- lib/bas/mapper/imap/support_emails.rb
|
72
|
+
- lib/bas/mapper/notion/birthday_today.rb
|
73
|
+
- lib/bas/mapper/notion/pto_today.rb
|
74
|
+
- lib/bas/mapper/notion/work_items_limit.rb
|
75
|
+
- lib/bas/mapper/postgres/pto_today.rb
|
76
|
+
- lib/bas/use_cases/types/config.rb
|
77
|
+
- lib/bas/use_cases/use_case.rb
|
78
|
+
- lib/bas/use_cases/use_cases.rb
|
79
|
+
- lib/bas/version.rb
|
80
|
+
- renovate.json
|
81
|
+
- sig/business_automation_system.rbs
|
82
|
+
homepage: https://github.com/kommitters/bas
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata:
|
86
|
+
homepage_uri: https://github.com/kommitters/bas
|
87
|
+
source_code_uri: https://github.com/kommitters/bas
|
88
|
+
post_install_message:
|
89
|
+
rdoc_options: []
|
90
|
+
require_paths:
|
91
|
+
- lib
|
92
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.6.0
|
97
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubygems_version: 3.5.3
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: BAS - Business automation system
|
107
|
+
test_files: []
|