Module: CubaApi::AcceptContent
- Defined in:
- lib/cuba_api/aspects/accept_content.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
64 65 66 |
# File 'lib/cuba_api/aspects/accept_content.rb', line 64 def self.included( base ) base.append_aspect :accept_content end |
Instance Method Details
#accept_content(obj, options = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/cuba_api/aspects/accept_content.rb', line 52 def accept_content( obj, = {} ) 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 |