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.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
- #error_body ⇒ Object
-
#initialize(status, id, message, request = nil) ⇒ ValidationError
constructor
A new instance of ValidationError.
- #render ⇒ Object
Constructor Details
#initialize(status, id, message, request = nil) ⇒ ValidationError
Returns a new instance of ValidationError.
7 8 9 10 11 12 |
# File 'lib/committee/validation_error.rb', line 7 def initialize(status, id, , request = nil) @status = status @id = id @message = @request = request end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/committee/validation_error.rb', line 5 def id @id end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
5 6 7 |
# File 'lib/committee/validation_error.rb', line 5 def @message end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'lib/committee/validation_error.rb', line 5 def request @request end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'lib/committee/validation_error.rb', line 5 def status @status end |
Instance Method Details
#error_body ⇒ Object
14 15 16 |
# File 'lib/committee/validation_error.rb', line 14 def error_body { id: id, message: } end |
#render ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/committee/validation_error.rb', line 18 def render [ status, { "Content-Type" => "application/json" }, [JSON.generate(error_body)] ] end |