Class: JSONAPI::Serializable::Error
- Inherits:
-
Object
- Object
- JSONAPI::Serializable::Error
- Includes:
- ErrorDSL
- Defined in:
- lib/jsonapi/serializable/error.rb
Class Attribute Summary collapse
-
.code_block ⇒ Object
Returns the value of attribute code_block.
-
.code_val ⇒ Object
Returns the value of attribute code_val.
-
.detail_block ⇒ Object
Returns the value of attribute detail_block.
-
.detail_val ⇒ Object
Returns the value of attribute detail_val.
-
.id_block ⇒ Object
Returns the value of attribute id_block.
-
.id_val ⇒ Object
Returns the value of attribute id_val.
-
.link_blocks ⇒ Object
Returns the value of attribute link_blocks.
-
.meta_block ⇒ Object
Returns the value of attribute meta_block.
-
.meta_val ⇒ Object
Returns the value of attribute meta_val.
-
.source_block ⇒ Object
Returns the value of attribute source_block.
-
.status_block ⇒ Object
Returns the value of attribute status_block.
-
.status_val ⇒ Object
Returns the value of attribute status_val.
-
.title_block ⇒ Object
Returns the value of attribute title_block.
-
.title_val ⇒ Object
Returns the value of attribute title_val.
Class Method Summary collapse
Instance Method Summary collapse
- #as_jsonapi ⇒ Object
-
#initialize(exposures = {}) ⇒ Error
constructor
A new instance of Error.
Methods included from ErrorDSL
Constructor Details
#initialize(exposures = {}) ⇒ Error
Returns a new instance of Error.
45 46 47 48 |
# File 'lib/jsonapi/serializable/error.rb', line 45 def initialize(exposures = {}) @_exposures = exposures exposures.each { |k, v| instance_variable_set("@#{k}", v) } end |
Class Attribute Details
.code_block ⇒ Object
Returns the value of attribute code_block.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def code_block @code_block end |
.code_val ⇒ Object
Returns the value of attribute code_val.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def code_val @code_val end |
.detail_block ⇒ Object
Returns the value of attribute detail_block.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def detail_block @detail_block end |
.detail_val ⇒ Object
Returns the value of attribute detail_val.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def detail_val @detail_val end |
.id_block ⇒ Object
Returns the value of attribute id_block.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def id_block @id_block end |
.id_val ⇒ Object
Returns the value of attribute id_val.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def id_val @id_val end |
.link_blocks ⇒ Object
Returns the value of attribute link_blocks.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def link_blocks @link_blocks end |
.meta_block ⇒ Object
Returns the value of attribute meta_block.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def end |
.meta_val ⇒ Object
Returns the value of attribute meta_val.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def end |
.source_block ⇒ Object
Returns the value of attribute source_block.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def source_block @source_block end |
.status_block ⇒ Object
Returns the value of attribute status_block.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def status_block @status_block end |
.status_val ⇒ Object
Returns the value of attribute status_val.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def status_val @status_val end |
.title_block ⇒ Object
Returns the value of attribute title_block.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def title_block @title_block end |
.title_val ⇒ Object
Returns the value of attribute title_val.
32 33 34 |
# File 'lib/jsonapi/serializable/error.rb', line 32 def title_val @title_val end |
Class Method Details
.inherited(klass) ⇒ Object
40 41 42 43 |
# File 'lib/jsonapi/serializable/error.rb', line 40 def self.inherited(klass) super klass.link_blocks = link_blocks.dup end |
Instance Method Details
#as_jsonapi ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/jsonapi/serializable/error.rb', line 50 def as_jsonapi hash = links.any? ? { links: links } : {} [:id, :status, :code, :title, :detail, :meta, :source] .each_with_object(hash) do |key, h| value = send(key) h[key] = value unless value.nil? end end |