Class: BaseHandler
- Inherits:
-
Object
- Object
- BaseHandler
- Defined in:
- lib/imagefactory/base_handler.rb
Instance Method Summary collapse
- #handle(data) ⇒ Object
- #handle_failed(data) ⇒ Object
- #handle_status(data) ⇒ Object
-
#initialize(logger = nil) ⇒ BaseHandler
constructor
A new instance of BaseHandler.
Constructor Details
#initialize(logger = nil) ⇒ BaseHandler
Returns a new instance of BaseHandler.
24 25 26 |
# File 'lib/imagefactory/base_handler.rb', line 24 def initialize(logger=nil) logger(logger) end |
Instance Method Details
#handle(data) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/imagefactory/base_handler.rb', line 28 def handle(data) logger.debug "====== Type of event: #{data.event}" if data.event == 'STATUS' logger.debug "calling handle status in base handler" handle_status(data) elsif data.event == 'FAILURE' handle_failed(data) end end |
#handle_failed(data) ⇒ Object
42 43 44 |
# File 'lib/imagefactory/base_handler.rb', line 42 def handle_failed(data) logger.error "#{data.to_s}" end |
#handle_status(data) ⇒ Object
38 39 40 |
# File 'lib/imagefactory/base_handler.rb', line 38 def handle_status(data) logger.debug "{data.event}, #{data.new_status}" end |