-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #31 Release Cleanup and Documentation
* Add more info to README, move action runner to service class * Clarify webhook usage * Fix table column verbiage * Change pipeline names
- Loading branch information
1 parent
ba24b61
commit f79b5fc
Showing
6 changed files
with
139 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Deploy Develop | ||
name: Deploy to the Dev Environment | ||
|
||
on: | ||
pull_request: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Deploy Production | ||
name: Deploy to the Production Environment | ||
|
||
on: | ||
release: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Deploy Staging | ||
name: Deploy to the Staging Environment | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
"use strict"; | ||
|
||
const assets = Runtime.getAssets(); | ||
const BroadcastAction = require(assets["/actions/BroadcastAction.js"].path); | ||
const Config = require(assets["/Config.js"].path); | ||
const InputCommandEnum = require(assets["/enums/InputCommandEnum.js"].path); | ||
const InputParserService = require(assets["/services/InputParserService.js"].path); | ||
const ResubscribeAction = require(assets["/actions/ResubscribeAction.js"].path); | ||
const StatusAction = require(assets["/actions/StatusAction.js"].path); | ||
const SubscribeAction = require(assets["/actions/SubscribeAction.js"].path); | ||
const UnsubscribeAction = require(assets["/actions/UnsubscribeAction.js"].path); | ||
const WebhookService = require(assets["/services/WebhookService.js"].path); | ||
|
||
class MessagingService { | ||
run(event) { | ||
const parser = new InputParserService(event); | ||
const model = parser.commandInputModel; | ||
let response = null; | ||
|
||
switch (model.command) { | ||
case InputCommandEnum.BROADCAST_ANNOUNCEMENT_CALENDAR: | ||
const broadcast = new BroadcastAction(model); | ||
|
||
response = broadcast.run( | ||
Config.AnnouncementCalendar.Broadcast.Success, | ||
Config.AnnouncementCalendar.Broadcast.EmptyMessage, | ||
Config.AnnouncementCalendar.Broadcast.Unauthorized, | ||
Config.AnnouncementCalendar.Broadcast.AuthorizedPhoneNumbers, | ||
Config.AnnouncementCalendar.BindingType, | ||
Config.AnnouncementCalendar.Tags | ||
); | ||
|
||
break; | ||
|
||
case InputCommandEnum.HELP: | ||
const help = new StatusAction(model); | ||
|
||
response = help.run( | ||
Config.Help.IsRegistered, | ||
Config.Help.IsNotRegistered | ||
); | ||
|
||
break; | ||
|
||
case InputCommandEnum.RESUBSCRIBE: | ||
const resubscribe = new ResubscribeAction(model); | ||
|
||
response = resubscribe.run( | ||
Config.Resubscribe.Message | ||
); | ||
|
||
break; | ||
|
||
case InputCommandEnum.STATUS: | ||
const status = new StatusAction(model); | ||
|
||
response = status.run( | ||
Config.Status.IsRegistered, | ||
Config.Status.IsNotRegistered | ||
); | ||
|
||
break; | ||
|
||
case InputCommandEnum.SUBSCRIBE_ANNOUNCEMENT_CALENDAR: | ||
const subscribe = new SubscribeAction(model); | ||
|
||
response = subscribe.run( | ||
Config.AnnouncementCalendar.Subscribe.NewUser, | ||
Config.AnnouncementCalendar.Subscribe.ExistingUser, | ||
Config.AnnouncementCalendar.BindingType, | ||
Config.AnnouncementCalendar.Tags | ||
); | ||
|
||
break; | ||
|
||
case InputCommandEnum.UNSUBSCRIBE: | ||
const unsubscribe = new UnsubscribeAction(model); | ||
response = unsubscribe.run(); | ||
break; | ||
|
||
default: | ||
const webhook = new WebhookService(); | ||
|
||
response = webhook | ||
.sendInvalidMessage(model.message, model.phoneNumber) | ||
.then(() => { | ||
return Config.InvalidRequest; | ||
}); | ||
|
||
break; | ||
} | ||
|
||
return response; | ||
} | ||
} | ||
|
||
module.exports = MessagingService; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters