Class: Committee::ValidationError
- Inherits:
-
Object
- Object
- Committee::ValidationError
- Defined in:
- lib/committee/validation_error.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #error_body ⇒ Object
-
#initialize(status, id, message) ⇒ ValidationError
constructor
A new instance of ValidationError.
- #render ⇒ Object
Constructor Details
#initialize(status, id, message) ⇒ ValidationError
Returns a new instance of ValidationError.
5 6 7 8 9 |
# File 'lib/committee/validation_error.rb', line 5 def initialize(status, id, ) @status = status @id = id @message = end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/committee/validation_error.rb', line 3 def id @id end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/committee/validation_error.rb', line 3 def @message end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/committee/validation_error.rb', line 3 def status @status end |
Instance Method Details
#error_body ⇒ Object
11 12 13 |
# File 'lib/committee/validation_error.rb', line 11 def error_body { id: id, message: } end |
#render ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/committee/validation_error.rb', line 15 def render [ status, { "Content-Type" => "application/json" }, [JSON.generate(error_body)] ] end |