Class: Integrations::SlackInteractionService
- Inherits:
-
Object
- Object
- Integrations::SlackInteractionService
- Defined in:
- app/services/integrations/slack_interaction_service.rb
Constant Summary collapse
- UnknownInteractionError =
Class.new(StandardError)
- INTERACTIONS =
{ 'view_closed' => SlackInteractions::IncidentManagement::IncidentModalClosedService, 'view_submission' => SlackInteractions::IncidentManagement::IncidentModalSubmitService, 'block_actions' => SlackInteractions::BlockActionService }.freeze
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params) ⇒ SlackInteractionService
constructor
A new instance of SlackInteractionService.
Constructor Details
#initialize(params) ⇒ SlackInteractionService
Returns a new instance of SlackInteractionService.
13 14 15 16 |
# File 'app/services/integrations/slack_interaction_service.rb', line 13 def initialize(params) @interaction_type = params.delete(:type) @params = params end |
Instance Method Details
#execute ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/services/integrations/slack_interaction_service.rb', line 18 def execute raise UnknownInteractionError, "Unable to handle interaction type: '#{interaction_type}'" \ unless interaction?(interaction_type) service_class = INTERACTIONS[interaction_type] service_class.new(params).execute ServiceResponse.success end |