Class: YunTongXun::ResultHandler
- Inherits:
-
Object
- Object
- YunTongXun::ResultHandler
- Defined in:
- lib/yun_tong_xun/result_handler.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #code ⇒ Object
-
#initialize(raw) ⇒ ResultHandler
constructor
A new instance of ResultHandler.
- #msg ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(raw) ⇒ ResultHandler
Returns a new instance of ResultHandler.
4 5 6 7 |
# File 'lib/yun_tong_xun/result_handler.rb', line 4 def initialize(raw) @raw = raw @json = JSON.parse(raw) end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
3 4 5 |
# File 'lib/yun_tong_xun/result_handler.rb', line 3 def json @json end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
3 4 5 |
# File 'lib/yun_tong_xun/result_handler.rb', line 3 def raw @raw end |
Instance Method Details
#code ⇒ Object
13 14 15 |
# File 'lib/yun_tong_xun/result_handler.rb', line 13 def code json['statusCode'] end |
#msg ⇒ Object
17 18 19 |
# File 'lib/yun_tong_xun/result_handler.rb', line 17 def msg json['statusMsg'] end |
#valid? ⇒ Boolean
9 10 11 |
# File 'lib/yun_tong_xun/result_handler.rb', line 9 def valid? code == '000000' end |