Class: EdgycircleToolbox::Sonapi::ErrorResource

Inherits:
Object
  • Object
show all
Defined in:
lib/edgycircle_toolbox/sonapi/error_resource.rb

Class Method Summary collapse

Class Method Details

.serialize(errors) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/edgycircle_toolbox/sonapi/error_resource.rb', line 4

def self.serialize(errors)
  {
    "errors" => errors.map do |error|
      hash = {
        "title" => error.title,
        "detail" => error.detail
      }

      if error.pointer
        hash["source"] = { "pointer" => error.pointer }
      end

      hash
    end
  }
end