Class: Baiwang::Result
- Inherits:
-
Object
- Object
- Baiwang::Result
- Defined in:
- lib/baiwang/request.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
-
#initialize(data) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ Result
Returns a new instance of Result.
75 76 77 78 79 |
# File 'lib/baiwang/request.rb', line 75 def initialize(data) @code = data['code'].to_i @data = data['response'] @error = data['errorResponse'] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
73 74 75 |
# File 'lib/baiwang/request.rb', line 73 def code @code end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
73 74 75 |
# File 'lib/baiwang/request.rb', line 73 def data @data end |
#error ⇒ Object (readonly)
Returns the value of attribute error.
73 74 75 |
# File 'lib/baiwang/request.rb', line 73 def error @error end |
Instance Method Details
#success? ⇒ Boolean
81 82 83 |
# File 'lib/baiwang/request.rb', line 81 def success? code.zero? && error.empty? end |