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



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/endpoint_base/concerns/sinatra_responder.rb', line 18

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