class Snowly::App::Collector

Constants

GIF

Public Instance Methods

handle_response(validator) click to toggle source
# 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