Exception: Mountapi::Error::InvalidResponse

Inherits:
StandardError
  • Object
show all
Defined in:
lib/mountapi/error/invalid_response.rb

Overview

When a response does not match it’s schema

Instance Method Summary collapse

Constructor Details

#initialize(errors) ⇒ InvalidResponse

Returns a new instance of InvalidResponse.



5
6
7
8
# File 'lib/mountapi/error/invalid_response.rb', line 5

def initialize(errors)
  @errors = errors
  super(errors)
end

Instance Method Details

#to_json_apiObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/mountapi/error/invalid_response.rb', line 10

def to_json_api
  @errors.map do |error|
    {
      id: error[:schema],
      title: error[:message],
      status: 500,
      source: {
        pointer: error[:fragment],
        parameter: error[:failed_attribute]
      }
    }
  end
end