Class: ApiValve::ErrorResponder

Inherits:
Object
  • Object
show all
Defined in:
lib/api_valve/error_responder.rb

Instance Method Summary collapse

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

#callObject



7
8
9
10
11
12
13
# File 'lib/api_valve/error_responder.rb', line 7

def call
  [
    status,
    {'Content-Type' => 'application/vnd.api+json'},
    [MultiJson.dump({errors: [json_error]}, mode: :compat)]
  ]
end