Class: Easydocforms::Generators::WebhookGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Easydocforms::Generators::WebhookGenerator
- Defined in:
- lib/generators/easydocforms/webhook/webhook_generator.rb
Overview
rails generate easydocforms:webhook
Creates a webhook receiver controller that verifies X-EDF-Signature and prints the route + credentials setup to finish wiring it up.
Instance Method Summary collapse
Instance Method Details
#create_controller ⇒ Object
14 15 16 |
# File 'lib/generators/easydocforms/webhook/webhook_generator.rb', line 14 def create_controller copy_file "webhooks_controller.rb", "app/controllers/easydocforms_webhooks_controller.rb" end |
#show_instructions ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/generators/easydocforms/webhook/webhook_generator.rb', line 18 def show_instructions say <<~INSTRUCTIONS EasyDocForms webhook receiver created. Two steps to finish: 1. Add the route (config/routes.rb): post "/webhooks/easydocforms", to: "easydocforms_webhooks#create" 2. Store the signing secret (shown once when you register the webhook): bin/rails credentials:edit # easydocforms: # webhook_secret: whsec_... Then register the endpoint: EasyDocForms::Client.new(ENV["EASYDOCFORMS_API_KEY"]) .create_webhook(url: "https://your-app.example.com/webhooks/easydocforms") INSTRUCTIONS end |