Class: Express::Result
- Inherits:
-
Object
- Object
- Express::Result
- Defined in:
- lib/express/result.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(json) ⇒ Result
constructor
A new instance of Result.
- #success? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(json) ⇒ Result
Returns a new instance of Result.
6 7 8 9 |
# File 'lib/express/result.rb', line 6 def initialize(json) self.status = json['status'] self.data = json['data'] end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/express/result.rb', line 4 def data @data end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/express/result.rb', line 4 def status @status end |
Instance Method Details
#success? ⇒ Boolean
11 12 13 |
# File 'lib/express/result.rb', line 11 def success? status == '3' end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/express/result.rb', line 15 def to_s {success: self.success?, data: self.data}.to_s end |