Module: EndpointBase::Concerns::SinatraResponder::Helpers

Defined in:
lib/endpoint_base/concerns/sinatra_responder.rb

Instance Method Summary collapse

Instance Method Details

#process_result(code, response = nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/endpoint_base/concerns/sinatra_responder.rb', line 24

def process_result(code, response = nil)
  status code
  content_type 'application/json', :charset => 'utf-8'

  if response
    warn '[DEPRECATION WARNING] Passing a hash as a second argument to `process_result` is deprecated, use Response DSL instead.'
    @attrs = response
  end

  jbuilder :'response.json', views: "#{EndpointBase.path_to_views}/application"
end