Class: JSONAPI::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonapi/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Error



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/jsonapi/error.rb', line 5

def initialize(options = {})
  @title          = options[:title]
  @detail         = options[:detail]
  @id             = options[:id]
  @href           = options[:href]
  @code           = if JSONAPI.configuration.use_text_errors
                      TEXT_ERRORS[options[:code]]
                    else
                      options[:code]
                    end
  @path           = options[:path]
  @links          = options[:links]
  @status         = options[:status]
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



3
4
5
# File 'lib/jsonapi/error.rb', line 3

def code
  @code
end

#detailObject

Returns the value of attribute detail.



3
4
5
# File 'lib/jsonapi/error.rb', line 3

def detail
  @detail
end

#hrefObject

Returns the value of attribute href.



3
4
5
# File 'lib/jsonapi/error.rb', line 3

def href
  @href
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/jsonapi/error.rb', line 3

def id
  @id
end

Returns the value of attribute links.



3
4
5
# File 'lib/jsonapi/error.rb', line 3

def links
  @links
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/jsonapi/error.rb', line 3

def path
  @path
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/jsonapi/error.rb', line 3

def status
  @status
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/jsonapi/error.rb', line 3

def title
  @title
end