action_hooks 0.2.1 → 0.2.3

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: 022311a2bf5d47588bef0c50d8ec661bea05a17cb12a9e9bf35538891588e803
4
- data.tar.gz: 7026c3496e361f040b6ae619a9a72d9acf1f88e1df58e1de811fe259fb2c22a2
3
+ metadata.gz: 746725b887278777fcf39094664187a0fb77e1ee32ddfa5b40f608e125d6b4e0
4
+ data.tar.gz: f467f77f65cc88aa414db2bc49c43426f21ed32de380bb3f04bb5f3dc35a8e03
5
5
  SHA512:
6
- metadata.gz: 7069d4534e137e09cf2ae10277300aaee50020999f1865e8a24d9ac6bea09ff0e3125c4dbdf3193eeda3ce48a743117e758dcf019f9e25b1005d91c7784398a3
7
- data.tar.gz: c4e4483de897d4df4eb100d24740e3fcf3ffe0ff8b9afcf89497737c69e29f761b85841d9ab0fd423317b9c4b8bf595c021826db0f16cb495742382812467a79
6
+ metadata.gz: fd642216813b9e0ff6cb6109f4ead54a984e8ef4725161524b831418071ac24ce26fc3eaef2716fdfb73006cc35d9ebbc7b313d1bc34e95263d91a899948b952
7
+ data.tar.gz: 29863c78270ff16d2bc2ed0947b82cb4346ccd1006731304523dd96e00bc414e622bfd07300f9bdd9d6ea391cb0d35404bd9419d5c115a26fce8cd3052c6ba09
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.3] - 2026-03-02
4
+
5
+ - Fixed `ActionHooks::WebhookRequest` being unavailable in host applications. Moved from `app/models/` to `lib/action_hooks/webhook_request.rb` with explicit require.
6
+ - Fixed `ActionHooks::WebhookController` being unavailable for inheritance in host applications. Moved from `app/controllers/` to `lib/action_hooks/webhook_controller.rb` with explicit require.
7
+
3
8
  ## [0.2.1] - 2026-03-02
4
9
 
5
10
  - Fixed migration template to detect primary key type from Rails generators configuration instead of hardcoded PostgreSQL UUID check
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionHooks
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.3"
5
5
  end
@@ -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
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionHooks
4
+ class WebhookRequest < ActiveRecord::Base
5
+ self.table_name = "webhook_requests"
6
+
7
+ enum :state, {pending: 0, processed: 1, failed: 2}
8
+
9
+ validates :source, presence: true
10
+ validates :payload, presence: true
11
+ validates :state, presence: true
12
+
13
+ before_create :ensure_id
14
+
15
+ private
16
+
17
+ def ensure_id
18
+ self.id ||= SecureRandom.uuid
19
+ end
20
+ end
21
+ end
data/lib/action_hooks.rb CHANGED
@@ -8,3 +8,5 @@ module ActionHooks
8
8
  end
9
9
  require "action_hooks/engine"
10
10
  require "action_hooks/webhook_controller_behavior"
11
+ require "action_hooks/webhook_request"
12
+ require "action_hooks/webhook_controller"
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.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Poimtsev
@@ -122,7 +122,9 @@ 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
127
+ - lib/action_hooks/webhook_request.rb
126
128
  - lib/generators/action_hooks/install/install_generator.rb
127
129
  - lib/generators/action_hooks/install/templates/action_hooks.rb
128
130
  - lib/generators/action_hooks/install/templates/create_webhook_requests.rb.erb