Module: Platanus::InstanceMethods
- Defined in:
- lib/platanus/api_base.rb
Instance Method Summary collapse
-
#api_respond_empty(_options = {}) ⇒ Object
Renders an empty response.
-
#api_respond_error(_status, _error_obj = {}) ⇒ Object
Renders an error response.
-
#api_respond_with(_resource, _options = {}) ⇒ Object
Renders a regular response.
Instance Method Details
#api_respond_empty(_options = {}) ⇒ Object
Renders an empty response
69 70 71 72 |
# File 'lib/platanus/api_base.rb', line 69 def api_respond_empty(={}) [:json] = {} api_respond_with() end |
#api_respond_error(_status, _error_obj = {}) ⇒ Object
Renders an error response
87 88 89 90 91 |
# File 'lib/platanus/api_base.rb', line 87 def api_respond_error(_status, _error_obj={}) respond_with do |format| format.json { render :status => _status, :json => _error_obj } end end |
#api_respond_with(_resource, _options = {}) ⇒ Object
Renders a regular response
76 77 78 79 80 |
# File 'lib/platanus/api_base.rb', line 76 def api_respond_with(_resource, ={}) respond_with(_resource) do |format| format.json { render } end end |