Class: Zenrows::HookConfigurator Private
- Inherits:
-
Object
- Object
- Zenrows::HookConfigurator
- Defined in:
- lib/zenrows/client.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Helper class for per-client hook configuration
Provides the same hook registration DSL as Configuration.
Instance Method Summary collapse
-
#add_subscriber(subscriber) ⇒ Object
private
Add a subscriber object.
-
#after_request(callable = nil, &block) ⇒ Object
private
Register an after_request callback.
-
#around_request(callable = nil, &block) ⇒ Object
private
Register an around_request callback.
-
#before_request(callable = nil, &block) ⇒ Object
private
Register a before_request callback.
-
#initialize(hooks) ⇒ HookConfigurator
constructor
private
A new instance of HookConfigurator.
-
#on_error(callable = nil, &block) ⇒ Object
private
Register an on_error callback.
-
#on_response(callable = nil, &block) ⇒ Object
private
Register an on_response callback.
Constructor Details
#initialize(hooks) ⇒ HookConfigurator
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of HookConfigurator.
228 229 230 |
# File 'lib/zenrows/client.rb', line 228 def initialize(hooks) @hooks = hooks end |
Instance Method Details
#add_subscriber(subscriber) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Add a subscriber object
263 264 265 266 |
# File 'lib/zenrows/client.rb', line 263 def add_subscriber(subscriber) @hooks.add_subscriber(subscriber) self end |
#after_request(callable = nil, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Register an after_request callback
239 240 241 242 |
# File 'lib/zenrows/client.rb', line 239 def after_request(callable = nil, &block) @hooks.register(:after_request, callable, &block) self end |
#around_request(callable = nil, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Register an around_request callback
257 258 259 260 |
# File 'lib/zenrows/client.rb', line 257 def around_request(callable = nil, &block) @hooks.register(:around_request, callable, &block) self end |
#before_request(callable = nil, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Register a before_request callback
233 234 235 236 |
# File 'lib/zenrows/client.rb', line 233 def before_request(callable = nil, &block) @hooks.register(:before_request, callable, &block) self end |
#on_error(callable = nil, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Register an on_error callback
251 252 253 254 |
# File 'lib/zenrows/client.rb', line 251 def on_error(callable = nil, &block) @hooks.register(:on_error, callable, &block) self end |
#on_response(callable = nil, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Register an on_response callback
245 246 247 248 |
# File 'lib/zenrows/client.rb', line 245 def on_response(callable = nil, &block) @hooks.register(:on_response, callable, &block) self end |