Class: Hermes::OutboundWebhookProvider
- Defined in:
- lib/providers/outbound_webhook/outbound_webhook_provider.rb
Instance Attribute Summary
Attributes inherited from Provider
#credentials, #defaults, #deliverer, #weight
Instance Method Summary collapse
Methods inherited from Provider
#initialize, #message_failure, #message_success, #provider_name, required_credentials
Methods included from Extractors
#complex_extract, #extract_from, #extract_html, #extract_text, #extract_to
Constructor Details
This class inherits a constructor from Hermes::Provider
Instance Method Details
#payload(rails_message) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/providers/outbound_webhook/outbound_webhook_provider.rb', line 20 def payload() { :endpoint => extract_to(), :headers => { 'Content-Type' => 'application/json' }, :body => extract_text() } end |
#send_message(rails_message) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/providers/outbound_webhook/outbound_webhook_provider.rb', line 4 def () payload = payload() outbound_webhook = OutboundWebhook.create!(payload) [:message_id] = outbound_webhook.id byebug if self.deliverer.should_deliver? outbound_webhook.deliver_async end self.() rescue Exception => e self.(, e) end |