Class: Snowly::App::Collector
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- Snowly::App::Collector
- Defined in:
- lib/snowly/app/collector.rb
Constant Summary collapse
- GIF =
Base64.decode64('R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')
Instance Method Summary collapse
Instance Method Details
#handle_response(validator) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/snowly/app/collector.rb', line 16 def handle_response(validator) content_type :json if validator.validate status 200 if params[:debug] || Snowly.debug_mode content = validator.as_hash Snowly.logger.info content body(content.to_json) else content_type 'image/gif' Snowly::App::Collector::GIF end else status 422 content = validator.as_hash Snowly.logger.error content body (content.to_json) end end |