module CubaApi::AcceptContent
Public Class Methods
included( base )
click to toggle source
# File lib/cuba_api/aspects/accept_content.rb, line 64 def self.included( base ) base.append_aspect :accept_content end
Public Instance Methods
accept_content( obj, options = {} )
click to toggle source
# File lib/cuba_api/aspects/accept_content.rb, line 52 def accept_content( obj, options = {} ) mime = env[ 'HTTP_ACCEPT' ] if self.class.mimes.key?( mime ) res[ "Content-Type" ] = mime + "; charset=utf-8" obj.send self.class[ :mimes ][ mime ] else self.class.accept_logger.debug { "'#{mime}' not in allowed list #{self.class[ :mimes ].keys.inspect}" } no_body :not_found nil end end