Class: Code42Api::BaseResponder
- Inherits:
-
ActionController::Responder
- Object
- ActionController::Responder
- Code42Api::BaseResponder
- Defined in:
- lib/code42_api/base_responder.rb
Instance Method Summary collapse
Instance Method Details
#api_behavior(error) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/code42_api/base_responder.rb', line 4 def api_behavior(error) raise error unless resourceful? raise MissingRenderer.new(format) unless has_renderer? if get? display resource elsif post? display resource, status: :created, location: api_location elsif put? || patch? display resource, status: :ok else head :no_content end end |