Module: Integrations::HasWebHook
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/integrations/has_web_hook.rb
Instance Method Summary collapse
-
#execute_web_hook! ⇒ Object
Execute the webhook, creating it if necessary.
-
#hook_ssl_verification ⇒ Object
Return whether the webhook should use SSL verification.
-
#hook_url ⇒ Object
Return the URL to be used for the webhook.
-
#update_web_hook! ⇒ Object
Create or update the webhook, raising an exception if it cannot be saved.
-
#url_variables ⇒ Object
Return the url variables to be used for the webhook.
Instance Method Details
#execute_web_hook! ⇒ Object
Execute the webhook, creating it if necessary.
45 46 47 48 |
# File 'app/models/concerns/integrations/has_web_hook.rb', line 45 def execute_web_hook!(...) update_web_hook! service_hook.execute(...) end |
#hook_ssl_verification ⇒ Object
Return whether the webhook should use SSL verification.
23 24 25 26 27 28 29 |
# File 'app/models/concerns/integrations/has_web_hook.rb', line 23 def hook_ssl_verification if respond_to?(:enable_ssl_verification) enable_ssl_verification else true end end |
#hook_url ⇒ Object
Return the URL to be used for the webhook.
13 14 15 |
# File 'app/models/concerns/integrations/has_web_hook.rb', line 13 def hook_url raise NotImplementedError end |
#update_web_hook! ⇒ Object
Create or update the webhook, raising an exception if it cannot be saved.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/models/concerns/integrations/has_web_hook.rb', line 32 def update_web_hook! hook = service_hook || build_service_hook # Avoid reencryption hook.url = hook_url if hook.url != hook_url hook.url_variables = url_variables if hook.url_variables != url_variables hook.enable_ssl_verification = hook_ssl_verification hook.save! if hook.changed? hook end |
#url_variables ⇒ Object
Return the url variables to be used for the webhook.
18 19 20 |
# File 'app/models/concerns/integrations/has_web_hook.rb', line 18 def url_variables raise NotImplementedError end |