Class: RubyAem::Result
- Inherits:
-
Object
- Object
- RubyAem::Result
- Defined in:
- lib/ruby_aem/result.rb
Overview
Result represents the result of a client call.
It has 3 statuses: success, warning, and failure. A success indicates that the client call was completed successfully. A failure indicates that the client call was completed but it failed with error. A warning indicates that the client call was completed but with warnings.
Result message is stored in message attribute.
Some client calls respond with data payload, which is stored in data attribute.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(status, message) ⇒ Object
constructor
Initialise a result.
-
#is_failure? ⇒ Boolean
Check whether the client call failed.
-
#is_success? ⇒ Boolean
Check whether the client call was successful.
-
#is_warning? ⇒ Boolean
Check whether the client call was completed with warnings.
Constructor Details
#initialize(status, message) ⇒ Object
Initialise a result.
38 39 40 41 |
# File 'lib/ruby_aem/result.rb', line 38 def initialize(status, ) @status = status = end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
31 32 33 |
# File 'lib/ruby_aem/result.rb', line 31 def data @data end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
30 31 32 |
# File 'lib/ruby_aem/result.rb', line 30 def end |
Instance Method Details
#is_failure? ⇒ Boolean
Check whether the client call failed.
61 62 63 |
# File 'lib/ruby_aem/result.rb', line 61 def is_failure? return @status == 'failure' end |
#is_success? ⇒ Boolean
Check whether the client call was successful.
46 47 48 |
# File 'lib/ruby_aem/result.rb', line 46 def is_success? return @status == 'success' end |
#is_warning? ⇒ Boolean
Check whether the client call was completed with warnings.
54 55 56 |
# File 'lib/ruby_aem/result.rb', line 54 def is_warning? return @status == 'warning' end |