Class: Cuprum::Rails::Responders::Json::Resource

Inherits:
Cuprum::Rails::Responders::JsonResponder show all
Defined in:
lib/cuprum/rails/responders/json/resource.rb

Overview

Defines default responses for a RESTful resource.

  • #create success: serializes the data with status 201 Created.

  • failure AlreadyExists: serializes the error with status 422 Unprocessable

    Entity.
    
  • failure ExtraAttributes: serializes the error with status 422

    Unprocessable Entity.
    
  • failure FailedValidation: serializes the error with status 422

    Unprocessable Entity.
    
  • failure InvalidParameters: serializes the error with status 400 Bad

    Request.
    
  • failure NotFound: serializes the error with status 404 Not Found.

Responds to any other successful result by serializing the result value with status 200. For a failing result, serializes a generic error with status 500 Internal Server Error.

Instance Attribute Summary

Attributes included from Serialization

#serializers

Attributes included from Matching

#matcher

Attributes inherited from BaseResponder

#action_name, #controller, #controller_name, #request, #resource, #result

Method Summary

Methods inherited from Cuprum::Rails::Responders::JsonResponder

#call, #format, #generic_error, #initialize, #render, #render_failure, #render_success

Methods included from Serialization

#initialize, #serialize

Methods included from Actions

#call, included

Methods included from Matching

#call, #format, #initialize, #member_action?

Methods inherited from BaseResponder

#call, #initialize, #member_action?, #routes

Constructor Details

This class inherits a constructor from Cuprum::Rails::Responders::JsonResponder