Class: ApiValve::ErrorResponder
- Inherits:
-
Object
- Object
- ApiValve::ErrorResponder
- Defined in:
- lib/api_valve/error_responder.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(error) ⇒ ErrorResponder
constructor
A new instance of ErrorResponder.
Constructor Details
#initialize(error) ⇒ ErrorResponder
Returns a new instance of ErrorResponder.
3 4 5 |
# File 'lib/api_valve/error_responder.rb', line 3 def initialize(error) @error = error end |
Instance Method Details
#call ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/api_valve/error_responder.rb', line 7 def call Rack::Response[ status, {'Content-Type' => 'application/vnd.api+json'}, JSON.generate({errors: [json_error]}, mode: :compat) ] end |