Class: ActiveWebhook::Delivery::BaseAdapter
- Inherits:
-
Adapter
- Object
- Adapter
- ActiveWebhook::Delivery::BaseAdapter
show all
- Defined in:
- lib/active_webhook/delivery/base_adapter.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Adapter
attribute, attributes, #attributes, call, component_configuration, #component_configuration, configuration, #configuration, #initialize
Instance Attribute Details
#response ⇒ Object
Returns the value of attribute response.
7
8
9
|
# File 'lib/active_webhook/delivery/base_adapter.rb', line 7
def response
@response
end
|
Instance Method Details
#call ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/active_webhook/delivery/base_adapter.rb', line 15
def call
ensure_error_log_requirement_is_met!
wrap_with_log do
self.response = deliver!
case status_code
when 200
trace "Completed"
when 410
trace "Receieved HTTP response code [410] for"
subscription.destroy!
else
raise response.to_s
end
end
rescue StandardError => e
subscription.error_logs.create!
raise e end
|
#max_errors_per_hour ⇒ Object
11
12
13
|
# File 'lib/active_webhook/delivery/base_adapter.rb', line 11
def max_errors_per_hour
@max_errors_per_hour.nil? ? component_configuration.max_errors_per_hour : @max_errors_per_hour
end
|
#status_code ⇒ Object
37
38
39
|
# File 'lib/active_webhook/delivery/base_adapter.rb', line 37
def status_code
raise NotImplementedError, "#deliver! must be implemented."
end
|
#topic ⇒ Object
41
42
43
|
# File 'lib/active_webhook/delivery/base_adapter.rb', line 41
def topic
subscription.topic
end
|