Class: Stripe::StripeEventNotificationHandlerBase
- Inherits:
-
Object
- Object
- Stripe::StripeEventNotificationHandlerBase
show all
- Defined in:
- lib/stripe/stripe_event_notification_handler.rb
Overview
Shared internal registration and dispatch machinery for the two user-facing event handlers.
Instance Method Summary
collapse
Constructor Details
Returns a new instance of StripeEventNotificationHandlerBase.
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 14
def initialize(client, &fallback_callback)
raise ArgumentError, "You must pass a block to act as a fallback" if fallback_callback.nil?
@client = client
@fallback_callback = fallback_callback
@registered_handlers = {}
@has_handled_events = false
@pre_handle_callback = nil
end
|
Instance Method Details
#on_v1_billing_meter_error_report_triggered(&callback) ⇒ Object
event-handler-methods: The beginning of the section generated from our OpenAPI spec
86
87
88
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 86
def on_v1_billing_meter_error_report_triggered(&callback)
register("v1.billing.meter.error_report_triggered", &callback)
end
|
#on_v1_billing_meter_no_meter_found(&callback) ⇒ Object
90
91
92
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 90
def on_v1_billing_meter_no_meter_found(&callback)
register("v1.billing.meter.no_meter_found", &callback)
end
|
#on_v2_commerce_product_catalog_imports_failed(&callback) ⇒ Object
94
95
96
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 94
def on_v2_commerce_product_catalog_imports_failed(&callback)
register("v2.commerce.product_catalog.imports.failed", &callback)
end
|
#on_v2_commerce_product_catalog_imports_processing(&callback) ⇒ Object
98
99
100
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 98
def on_v2_commerce_product_catalog_imports_processing(&callback)
register("v2.commerce.product_catalog.imports.processing", &callback)
end
|
#on_v2_commerce_product_catalog_imports_succeeded(&callback) ⇒ Object
102
103
104
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 102
def on_v2_commerce_product_catalog_imports_succeeded(&callback)
register("v2.commerce.product_catalog.imports.succeeded", &callback)
end
|
#on_v2_commerce_product_catalog_imports_succeeded_with_errors(&callback) ⇒ Object
106
107
108
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 106
def on_v2_commerce_product_catalog_imports_succeeded_with_errors(&callback)
register("v2.commerce.product_catalog.imports.succeeded_with_errors", &callback)
end
|
#on_v2_core_account_closed(&callback) ⇒ Object
110
111
112
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 110
def on_v2_core_account_closed(&callback)
register("v2.core.account.closed", &callback)
end
|
#on_v2_core_account_created(&callback) ⇒ Object
114
115
116
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 114
def on_v2_core_account_created(&callback)
register("v2.core.account.created", &callback)
end
|
#on_v2_core_account_including_configuration_customer_capability_status_updated(&callback) ⇒ Object
122
123
124
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 122
def on_v2_core_account_including_configuration_customer_capability_status_updated(&callback)
register("v2.core.account[configuration.customer].capability_status_updated", &callback)
end
|
#on_v2_core_account_including_configuration_customer_updated(&callback) ⇒ Object
126
127
128
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 126
def on_v2_core_account_including_configuration_customer_updated(&callback)
register("v2.core.account[configuration.customer].updated", &callback)
end
|
#on_v2_core_account_including_configuration_merchant_capability_status_updated(&callback) ⇒ Object
130
131
132
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 130
def on_v2_core_account_including_configuration_merchant_capability_status_updated(&callback)
register("v2.core.account[configuration.merchant].capability_status_updated", &callback)
end
|
#on_v2_core_account_including_configuration_merchant_updated(&callback) ⇒ Object
134
135
136
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 134
def on_v2_core_account_including_configuration_merchant_updated(&callback)
register("v2.core.account[configuration.merchant].updated", &callback)
end
|
#on_v2_core_account_including_configuration_recipient_capability_status_updated(&callback) ⇒ Object
138
139
140
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 138
def on_v2_core_account_including_configuration_recipient_capability_status_updated(&callback)
register("v2.core.account[configuration.recipient].capability_status_updated", &callback)
end
|
#on_v2_core_account_including_configuration_recipient_updated(&callback) ⇒ Object
142
143
144
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 142
def on_v2_core_account_including_configuration_recipient_updated(&callback)
register("v2.core.account[configuration.recipient].updated", &callback)
end
|
#on_v2_core_account_including_defaults_updated(&callback) ⇒ Object
146
147
148
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 146
def on_v2_core_account_including_defaults_updated(&callback)
register("v2.core.account[defaults].updated", &callback)
end
|
#on_v2_core_account_including_future_requirements_updated(&callback) ⇒ Object
150
151
152
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 150
def on_v2_core_account_including_future_requirements_updated(&callback)
register("v2.core.account[future_requirements].updated", &callback)
end
|
#on_v2_core_account_including_identity_updated(&callback) ⇒ Object
154
155
156
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 154
def on_v2_core_account_including_identity_updated(&callback)
register("v2.core.account[identity].updated", &callback)
end
|
#on_v2_core_account_including_requirements_updated(&callback) ⇒ Object
158
159
160
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 158
def on_v2_core_account_including_requirements_updated(&callback)
register("v2.core.account[requirements].updated", &callback)
end
|
#on_v2_core_account_link_returned(&callback) ⇒ Object
162
163
164
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 162
def on_v2_core_account_link_returned(&callback)
register("v2.core.account_link.returned", &callback)
end
|
#on_v2_core_account_person_created(&callback) ⇒ Object
166
167
168
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 166
def on_v2_core_account_person_created(&callback)
register("v2.core.account_person.created", &callback)
end
|
#on_v2_core_account_person_deleted(&callback) ⇒ Object
170
171
172
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 170
def on_v2_core_account_person_deleted(&callback)
register("v2.core.account_person.deleted", &callback)
end
|
#on_v2_core_account_person_updated(&callback) ⇒ Object
174
175
176
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 174
def on_v2_core_account_person_updated(&callback)
register("v2.core.account_person.updated", &callback)
end
|
#on_v2_core_account_updated(&callback) ⇒ Object
118
119
120
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 118
def on_v2_core_account_updated(&callback)
register("v2.core.account.updated", &callback)
end
|
#on_v2_core_event_destination_ping(&callback) ⇒ Object
178
179
180
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 178
def on_v2_core_event_destination_ping(&callback)
register("v2.core.event_destination.ping", &callback)
end
|
#pre_handle(&hook) ⇒ Object
Registers a function that will be run before any event-specific callbacks. A useful
place to store event-agnostic logic, such as logging or checking for
duplicate event deliveries.
Returning true causes handling to continue as normal; returning false returns from
.handle() immediately, so neither the registered callback nor the fallback callback
are called.
36
37
38
39
40
41
42
43
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 36
def pre_handle(&hook)
assert_callback_given(hook)
assert_hasnt_handled_events
raise ArgumentError, "A pre_handle callback is already registered" if @pre_handle_callback
@pre_handle_callback = hook
end
|
#registered_event_types ⇒ Object
25
26
27
|
# File 'lib/stripe/stripe_event_notification_handler.rb', line 25
def registered_event_types
@registered_handlers.keys.sort
end
|