action_hooks 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a12fd0720059a53a672ff8e7a430d4c7bb5d3b28aeb4a52810ce85e8a5918abf
|
|
4
|
+
data.tar.gz: 5cf803c5a6305db6b9f7f616a1005c404b16fe518889406635119d0304946a85
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bcb0ee2b75349d2ceb5e1e9175b87582378966ec1a26759156758232b3d4db4135d501736a6475687ec5fb6efe3db4fcf1d925de2f42e5a1cb88e6016c539992
|
|
7
|
+
data.tar.gz: c9a60ae6c33e84ce2549cae8737b5630fcae9bd432d48955e88c3f6aeb7119eccc172f89289460d791ac514188fbe4721da9421a688a61cb3f26a315d2d0dfbd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.2.2] - 2026-03-02
|
|
4
|
+
|
|
5
|
+
- Fixed `ActionHooks::WebhookController` being unavailable for inheritance in host applications. Moved class from `app/controllers/` (Rails autoloading) to `lib/action_hooks/webhook_controller.rb` (explicit require), so the constant is available immediately when the gem is loaded.
|
|
6
|
+
|
|
7
|
+
## [0.2.1] - 2026-03-02
|
|
8
|
+
|
|
9
|
+
- Fixed migration template to detect primary key type from Rails generators configuration instead of hardcoded PostgreSQL UUID check
|
|
10
|
+
- Fixed JSON column type detection to use `t.respond_to?(:jsonb)` instead of checking adapter name directly
|
|
11
|
+
|
|
3
12
|
## [0.2.0] - 2026-03-02
|
|
4
13
|
|
|
5
14
|
- Refactored ActionHooks to operate purely as middleware. It now automatically mounts `POST /webhooks/:source` without needing any generated configuration route handling.
|
data/lib/action_hooks/version.rb
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module ActionHooks
|
|
4
|
+
class WebhookController < ActionController::API
|
|
5
|
+
include ActionHooks::WebhookControllerBehavior
|
|
6
|
+
|
|
7
|
+
def create
|
|
8
|
+
process_webhook(@webhook_request)
|
|
9
|
+
head :ok
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def process_webhook(webhook_request)
|
|
15
|
+
worker_class = webhook_source_config.worker
|
|
16
|
+
worker_class&.constantize&.perform_later(webhook_request.id)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/action_hooks.rb
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
class CreateWebhookRequests < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>]
|
|
2
2
|
def change
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
else
|
|
9
|
-
false # Defaults for others like SQLite, typical MySQL setups unless explicitly configured
|
|
3
|
+
create_table :webhook_requests, id: primary_key_type do |t|
|
|
4
|
+
if t.respond_to?(:jsonb)
|
|
5
|
+
t.jsonb :payload, default: {}, null: false
|
|
6
|
+
else
|
|
7
|
+
t.json :payload, default: {}, null: false
|
|
10
8
|
end
|
|
11
|
-
-%>
|
|
12
|
-
create_table :webhook_requests<%= supports_uuid ? ", id: :uuid" : "" %> do |t|
|
|
13
|
-
t.<%= json_type %> :payload, default: {}, null: false
|
|
14
9
|
t.string :source, null: false
|
|
15
10
|
t.integer :state, null: false, default: 0
|
|
16
11
|
|
|
@@ -20,4 +15,11 @@ class CreateWebhookRequests < ActiveRecord::Migration[<%= ActiveRecord::Migratio
|
|
|
20
15
|
add_index :webhook_requests, :source
|
|
21
16
|
add_index :webhook_requests, :state
|
|
22
17
|
end
|
|
18
|
+
|
|
19
|
+
private
|
|
20
|
+
|
|
21
|
+
def primary_key_type
|
|
22
|
+
config = Rails.configuration.generators
|
|
23
|
+
config.options[config.orm][:primary_key_type] || :primary_key
|
|
24
|
+
end
|
|
23
25
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: action_hooks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexey Poimtsev
|
|
@@ -122,6 +122,7 @@ files:
|
|
|
122
122
|
- lib/action_hooks/configuration.rb
|
|
123
123
|
- lib/action_hooks/engine.rb
|
|
124
124
|
- lib/action_hooks/version.rb
|
|
125
|
+
- lib/action_hooks/webhook_controller.rb
|
|
125
126
|
- lib/action_hooks/webhook_controller_behavior.rb
|
|
126
127
|
- lib/generators/action_hooks/install/install_generator.rb
|
|
127
128
|
- lib/generators/action_hooks/install/templates/action_hooks.rb
|