Class: JSONAPI::Warning
- Inherits:
-
Object
- Object
- JSONAPI::Warning
- Defined in:
- lib/jsonapi/error.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#detail ⇒ Object
Returns the value of attribute detail.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Warning
constructor
A new instance of Warning.
- #to_hash ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Warning
Returns a new instance of Warning.
46 47 48 49 50 51 52 53 54 |
# File 'lib/jsonapi/error.rb', line 46 def initialize( = {}) @title = [:title] @detail = [:detail] @code = if JSONAPI.configuration.use_text_errors TEXT_ERRORS[[:code]] else [:code] end end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
45 46 47 |
# File 'lib/jsonapi/error.rb', line 45 def code @code end |
#detail ⇒ Object
Returns the value of attribute detail.
45 46 47 |
# File 'lib/jsonapi/error.rb', line 45 def detail @detail end |
#title ⇒ Object
Returns the value of attribute title.
45 46 47 |
# File 'lib/jsonapi/error.rb', line 45 def title @title end |
Instance Method Details
#to_hash ⇒ Object
56 57 58 59 60 |
# File 'lib/jsonapi/error.rb', line 56 def to_hash hash = {} instance_variables.each {|var| hash[var.to_s.delete('@')] = instance_variable_get(var) unless instance_variable_get(var).nil? } hash end |