Module: Eazypi::ApiController::InstanceMethods

Defined in:
lib/eazypi/api_controller.rb

Overview

Instance methods to be used in your own API controller

Instance Method Summary collapse

Instance Method Details

#respond_with(object, status: :ok) ⇒ Object



60
61
62
63
64
65
66
# File 'lib/eazypi/api_controller.rb', line 60

def respond_with(object, status: :ok)
  response_type = @current_operation.response_for_response_code(status)

  response_object_type = response_type.object_type_for_content_type

  render json: Serializer.serialize_object(response_object_type, object), status: status
end