Class: ActionHooks::Generators::WebhookGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/action_hooks/webhook/webhook_generator.rb

Instance Method Summary collapse

Instance Method Details

#add_routeObject



26
27
28
29
# File 'lib/generators/action_hooks/webhook/webhook_generator.rb', line 26

def add_route
  return unless options[:controller]
  route %(post "webhooks/#{file_name}", to: "webhooks/#{file_name}#create")
end

#create_controller_fileObject



21
22
23
24
# File 'lib/generators/action_hooks/webhook/webhook_generator.rb', line 21

def create_controller_file
  return unless options[:controller]
  template "controller.rb.erb", "app/controllers/webhooks/#{file_name}_controller.rb"
end

#create_job_fileObject



16
17
18
19
# File 'lib/generators/action_hooks/webhook/webhook_generator.rb', line 16

def create_job_file
  return if options[:skip_job]
  template "job.rb.erb", "app/jobs/#{file_name}_webhook_job.rb"
end