Exception: SimpleJsonapi::DuplicateResourceError
- Inherits:
-
StandardError
- Object
- StandardError
- SimpleJsonapi::DuplicateResourceError
- Defined in:
- lib/simple_jsonapi/helpers/exceptions.rb
Overview
The error raised when the same resource is added to the included
member twice.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, id, msg = nil) ⇒ DuplicateResourceError
constructor
A new instance of DuplicateResourceError.
- #to_s ⇒ Object
Constructor Details
#initialize(type, id, msg = nil) ⇒ DuplicateResourceError
Returns a new instance of DuplicateResourceError.
13 14 15 16 17 |
# File 'lib/simple_jsonapi/helpers/exceptions.rb', line 13 def initialize(type, id, msg = nil) @type = type @id = id @msg = msg end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/simple_jsonapi/helpers/exceptions.rb', line 8 def id @id end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/simple_jsonapi/helpers/exceptions.rb', line 8 def type @type end |
Instance Method Details
#to_s ⇒ Object
19 20 21 |
# File 'lib/simple_jsonapi/helpers/exceptions.rb', line 19 def to_s @msg.present? ? @msg : "Resource with type #{type} and id #{id} is already included" end |