Class: Integrations::SlackOptionService
- Inherits:
-
Object
- Object
- Integrations::SlackOptionService
- Defined in:
- app/services/integrations/slack_option_service.rb
Constant Summary collapse
- UnknownOptionError =
Class.new(StandardError)
- OPTIONS =
{ 'assignee' => SlackOptions::UserSearchHandler, 'labels' => SlackOptions::LabelSearchHandler }.freeze
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(params) ⇒ SlackOptionService
constructor
A new instance of SlackOptionService.
Constructor Details
#initialize(params) ⇒ SlackOptionService
Returns a new instance of SlackOptionService.
12 13 14 15 16 17 |
# File 'app/services/integrations/slack_option_service.rb', line 12 def initialize(params) @params = params @search_type = params.delete(:action_id) @selected_value = params.delete(:value) @view_id = params.dig(:view, :id) end |
Instance Method Details
#execute ⇒ Object
19 20 21 22 23 24 25 |
# File 'app/services/integrations/slack_option_service.rb', line 19 def execute raise UnknownOptionError, "Unable to handle option: '#{search_type}'" \ unless option?(search_type) handler_class = OPTIONS[search_type] handler_class.new(current_user, selected_value, view_id).execute end |