Adds a Webhook adapter and includes OpenFn support
This commit is contained in:
parent
6ab7473ef7
commit
c676e70a49
5 changed files with 31 additions and 0 deletions
|
@ -21,6 +21,7 @@ PATH
|
|||
specs:
|
||||
bess (0.1.0)
|
||||
rails (~> 6.0)
|
||||
rest-client
|
||||
wisper (~> 2.0)
|
||||
wisper-activejob (~> 1.0.0)
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
|
|||
spec.add_dependency "rails", "~> 6.0"
|
||||
spec.add_dependency 'wisper', '~> 2.0'
|
||||
spec.add_dependency 'wisper-activejob', '~> 1.0.0'
|
||||
spec.add_dependency 'rest-client'
|
||||
|
||||
spec.add_development_dependency 'rspec', '~> 3.9.0'
|
||||
spec.add_development_dependency 'rspec-rails', '~> 4.0.0'
|
||||
|
|
|
@ -12,6 +12,7 @@ module Houdini
|
|||
autoload :Intl
|
||||
autoload :PaymentProvider
|
||||
autoload :EventPublisher
|
||||
autoload :WebhookAdapter
|
||||
|
||||
mattr_accessor :intl, :maintenance, :ccs
|
||||
|
||||
|
@ -38,4 +39,6 @@ module Houdini
|
|||
mattr_accessor :core_classes, default: {supporter: 'Supporter', nonprofit: 'Nonprofit'}
|
||||
|
||||
mattr_accessor :event_publisher, default: Houdini::EventPublisher.new
|
||||
|
||||
mattr_accessor :webhook_adapter
|
||||
end
|
||||
|
|
22
gems/bess/lib/houdini/webhook_adapter.rb
Normal file
22
gems/bess/lib/houdini/webhook_adapter.rb
Normal file
|
@ -0,0 +1,22 @@
|
|||
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
||||
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
||||
class Houdini::WebhookAdapter
|
||||
extend ActiveSupport::Autoload
|
||||
include ActiveModel::AttributeAssignment
|
||||
|
||||
autoload :OpenFn
|
||||
|
||||
attr_accessor :url, :auth_headers
|
||||
def initialize(attributes={})
|
||||
assign_attributes(attributes) if attributes
|
||||
end
|
||||
|
||||
def post(payload)
|
||||
RestClient::Request.execute(
|
||||
method: :post,
|
||||
url: url,
|
||||
payload: payload,
|
||||
headers: auth_headers
|
||||
)
|
||||
end
|
||||
end
|
4
gems/bess/lib/houdini/webhook_adapter/open_fn.rb
Normal file
4
gems/bess/lib/houdini/webhook_adapter/open_fn.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
# License: AGPL-3.0-or-later WITH WTO-AP-3.0-or-later
|
||||
# Full license explanation at https://github.com/houdiniproject/houdini/blob/master/LICENSE
|
||||
class Houdini::WebhookAdapter::OpenFn < Houdini::WebhookAdapter
|
||||
end
|
Loading…
Reference in a new issue