Method: Creatary::API#dispatch_to_handler
- Defined in:
- lib/creatary/api.rb
#dispatch_to_handler(method, *args) ⇒ Object
Dispatches the request to the Creatary handler configured by this gem client
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/creatary/api.rb', line 23 def dispatch_to_handler(method, *args) if Creatary.consumer_handler.nil? LOGGER.error 'Application has not configured the Creatary consumer_handler' raise InvalidConsumerHandler.new 'Application has not configured the Creatary consumer_handler' end if Creatary.consumer_handler.respond_to?(method) begin return Creatary.consumer_handler.send(method, *args) rescue Creatary::Error => error LOGGER.error 'Application has suffered an internal error: ' + error. + ', ' + error.body raise error end end end |