module CubaApi::InputFilter
Public Instance Methods
req_filter( model = nil, context = nil )
click to toggle source
# File lib/cuba_api/input_filter.rb, line 12 def req_filter( model = nil, context = nil ) @_filter ||= begin filter = self.class.factory.new_filter( model ).use( context ) filter.filter_it( parse_request_body ) end end
Protected Instance Methods
parse_request_body()
click to toggle source
# File lib/cuba_api/input_filter.rb, line 22 def parse_request_body if env[ 'CONTENT_TYPE' ] =~ /^application\/json/ body = req.body.read body.empty? ? {} : MultiJson.load( body ) else {} end end