Class: ForestAdminDatasourceZendesk::Plugins::CreateTicketWithNotification

Inherits:
ForestAdminDatasourceCustomizer::Plugins::Plugin
  • Object
show all
Defined in:
lib/forest_admin_datasource_zendesk/plugins/create_ticket_with_notification.rb,
lib/forest_admin_datasource_zendesk/plugins/create_ticket_with_notification/form_builder.rb

Overview

Zendesk creates the requester user on the fly from the form’s email, so the action can be registered on any host collection — no relation to Zendesk needed.

Defined Under Namespace

Modules: FormBuilder

Constant Summary collapse

BaseAction =
ForestAdminDatasourceCustomizer::Decorators::Action::BaseAction
ActionScope =
ForestAdminDatasourceCustomizer::Decorators::Action::Types::ActionScope
ForestException =
ForestAdminDatasourceToolkit::Exceptions::ForestException
NAME =
'Create ticket and notify'.freeze

Instance Method Summary collapse

Instance Method Details

#run(_datasource_customizer, collection_customizer = nil, options = {}) ⇒ Object

Raises:



13
14
15
16
17
18
19
20
21
# File 'lib/forest_admin_datasource_zendesk/plugins/create_ticket_with_notification.rb', line 13

def run(_datasource_customizer, collection_customizer = nil, options = {})
  datasource = options[:datasource]
  raise ForestException, 'CreateTicketWithNotification plugin requires :datasource' unless datasource
  raise ForestException, 'CreateTicketWithNotification plugin requires a collection' unless collection_customizer

  opts = options.except(:datasource)
  opts[:email_templates] = Array(opts[:email_templates]).compact
  collection_customizer.add_action(opts[:action_name] || NAME, build_action(datasource, opts))
end