-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Renaming the gem from toddlerbot to slackify. * Cleanup of `lib/slackify` folder. * Added a new configuration: unhandled_handler. You can specify a subclass of `Slackify::Handlers::Base` in the config. This class will be called with `#unhandled` when a message has no regex match.
- Loading branch information
Showing
28 changed files
with
416 additions
and
378 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
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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
Rails.application.routes.draw do | ||
post '/toddlerbot/event', to: 'toddlerbot/slack#event_callback' | ||
post '/toddlerbot/interactive', to: 'toddlerbot/slack#interactive_callback' | ||
post '/toddlerbot/slash/:handler_class/:handler_method', to: 'toddlerbot/slack#slash_command_callback' | ||
post '/slackify/event', to: 'slackify/slack#event_callback' | ||
post '/slackify/interactive', to: 'slackify/slack#interactive_callback' | ||
post '/slackify/slash/:handler_class/:handler_method', to: 'slackify/slack#slash_command_callback' | ||
end |
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,27 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'slackify/configuration' | ||
require 'slackify/engine' | ||
require 'slackify/exceptions' | ||
require 'slackify/handlers' | ||
|
||
module Slackify | ||
class << self | ||
attr_writer :configuration | ||
def configuration | ||
@configuration ||= Configuration.new | ||
end | ||
|
||
def reset | ||
@configuration = Configuration.new | ||
end | ||
|
||
def configure | ||
yield(configuration) | ||
end | ||
|
||
def load_handlers | ||
@configuration.handlers = Handlers::Configuration.new | ||
end | ||
end | ||
end |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
module Toddlerbot | ||
module Slackify | ||
class Engine < Rails::Engine | ||
isolate_namespace Toddlerbot | ||
isolate_namespace Slackify | ||
end | ||
end |
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,11 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative 'handlers/base' | ||
require_relative 'handlers/configuration' | ||
require_relative 'handlers/unhandled_handler' | ||
require_relative 'handlers/validator' | ||
|
||
module Slackify | ||
module Handlers | ||
end | ||
end |
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,33 @@ | ||
# frozen_string_literal: true | ||
|
||
module Slackify | ||
module Handlers | ||
class Base | ||
@@supported_handlers = [] | ||
|
||
class << self | ||
attr_reader :allowed_slash_methods | ||
|
||
def slack_client | ||
Slackify.configuration.slack_client | ||
end | ||
|
||
def allow_slash_method(element) | ||
if @allowed_slash_methods | ||
@allowed_slash_methods.push(*element) | ||
else | ||
@allowed_slash_methods = Array(element) | ||
end | ||
end | ||
|
||
def inherited(subclass) | ||
@@supported_handlers.push(subclass.to_s) | ||
end | ||
|
||
def supported_handlers | ||
@@supported_handlers | ||
end | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.