Class: Itsf::Services::V2::Response::Base
- Inherits:
-
Object
- Object
- Itsf::Services::V2::Response::Base
- Extended by:
- ActiveModel::Naming
- Defined in:
- lib/itsf/services/v2/response/base.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#messages ⇒ Object
readonly
Returns the value of attribute messages.
-
#success ⇒ Object
writeonly
Sets the attribute success.
Class Method Summary collapse
Instance Method Summary collapse
- #failed? ⇒ Boolean
-
#initialize ⇒ Base
constructor
A new instance of Base.
- #read_attribute_for_validation(attr) ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
12 13 14 15 |
# File 'lib/itsf/services/v2/response/base.rb', line 12 def initialize @messages = [] @errors = ActiveModel::Errors.new(self) end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
8 9 10 |
# File 'lib/itsf/services/v2/response/base.rb', line 8 def errors @errors end |
#messages ⇒ Object
Returns the value of attribute messages.
9 10 11 |
# File 'lib/itsf/services/v2/response/base.rb', line 9 def @messages end |
#success=(value) ⇒ Object (writeonly)
Sets the attribute success
10 11 12 |
# File 'lib/itsf/services/v2/response/base.rb', line 10 def success=(value) @success = value end |
Class Method Details
.human_attribute_name(attr, _options = {}) ⇒ Object
29 30 31 |
# File 'lib/itsf/services/v2/response/base.rb', line 29 def self.human_attribute_name(attr, = {}) attr end |
.lookup_ancestors ⇒ Object
33 34 35 |
# File 'lib/itsf/services/v2/response/base.rb', line 33 def self.lookup_ancestors [self] end |
Instance Method Details
#failed? ⇒ Boolean
21 22 23 |
# File 'lib/itsf/services/v2/response/base.rb', line 21 def failed? !success? end |
#read_attribute_for_validation(attr) ⇒ Object
25 26 27 |
# File 'lib/itsf/services/v2/response/base.rb', line 25 def read_attribute_for_validation(attr) send(attr) end |
#success? ⇒ Boolean
17 18 19 |
# File 'lib/itsf/services/v2/response/base.rb', line 17 def success? @errors.blank? end |