Class: BombDefuser::ResponseHandler
- Inherits:
-
Object
- Object
- BombDefuser::ResponseHandler
- Defined in:
- lib/bomb_defuser/response_handler.rb
Instance Method Summary collapse
-
#initialize(parser = Yajl::Parser.new) ⇒ ResponseHandler
constructor
A new instance of ResponseHandler.
- #process(response) ⇒ Object
Constructor Details
#initialize(parser = Yajl::Parser.new) ⇒ ResponseHandler
Returns a new instance of ResponseHandler.
4 5 6 7 |
# File 'lib/bomb_defuser/response_handler.rb', line 4 def initialize(parser = Yajl::Parser.new) self.parser = parser self.logger = Configuration.logger end |
Instance Method Details
#process(response) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/bomb_defuser/response_handler.rb', line 9 def process(response) raise(Errors::UnrecognizedResponseError, "The response can't be nil") if response.nil? parse(response, parser) result_size > 1 ? process_collection : process_single_resource end |