Class: Services::Response
- Inherits:
-
Object
- Object
- Services::Response
- Defined in:
- lib/services/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
Instance Method Summary collapse
- #add_errors(*errors) ⇒ Object
-
#initialize ⇒ Response
constructor
A new instance of Response.
- #success? ⇒ Boolean
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/services/response.rb', line 6 def initialize @body = nil @errors = [] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/services/response.rb', line 3 def body @body end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/services/response.rb', line 4 def errors @errors end |
Instance Method Details
#add_errors(*errors) ⇒ Object
11 12 13 |
# File 'lib/services/response.rb', line 11 def add_errors(*errors) @errors.concat(Array(errors)) end |
#success? ⇒ Boolean
15 16 17 |
# File 'lib/services/response.rb', line 15 def success? errors.empty? end |