Class: Dingtalk::ResultHandler
- Inherits:
-
Object
- Object
- Dingtalk::ResultHandler
- Defined in:
- lib/dingtalk/handler/result_handler.rb
Instance Attribute Summary collapse
-
#cn_msg ⇒ Object
Returns the value of attribute cn_msg.
-
#code ⇒ Object
Returns the value of attribute code.
-
#en_msg ⇒ Object
Returns the value of attribute en_msg.
-
#result ⇒ Object
Returns the value of attribute result.
Instance Method Summary collapse
- #full_error_message ⇒ Object (also: #full_error_messages)
- #full_message ⇒ Object (also: #full_messages)
-
#initialize(code, en_msg, result = {}) ⇒ ResultHandler
constructor
A new instance of ResultHandler.
- #is_ok? ⇒ Boolean (also: #ok?)
Constructor Details
#initialize(code, en_msg, result = {}) ⇒ ResultHandler
Returns a new instance of ResultHandler.
5 6 7 8 9 10 |
# File 'lib/dingtalk/handler/result_handler.rb', line 5 def initialize(code, en_msg, result={}) @code = code || OK_CODE @en_msg = en_msg || OK_MSG @cn_msg = GLOBAL_CODES[@code.to_i] @result = package_result(result) end |
Instance Attribute Details
#cn_msg ⇒ Object
Returns the value of attribute cn_msg.
3 4 5 |
# File 'lib/dingtalk/handler/result_handler.rb', line 3 def cn_msg @cn_msg end |
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/dingtalk/handler/result_handler.rb', line 3 def code @code end |
#en_msg ⇒ Object
Returns the value of attribute en_msg.
3 4 5 |
# File 'lib/dingtalk/handler/result_handler.rb', line 3 def en_msg @en_msg end |
#result ⇒ Object
Returns the value of attribute result.
3 4 5 |
# File 'lib/dingtalk/handler/result_handler.rb', line 3 def result @result end |
Instance Method Details
#full_error_message ⇒ Object Also known as: full_error_messages
22 23 24 |
# File 'lib/dingtalk/handler/result_handler.rb', line 22 def if !is_ok? end |
#full_message ⇒ Object Also known as: full_messages
17 18 19 |
# File 'lib/dingtalk/handler/result_handler.rb', line 17 def "#{code}: #{en_msg}(#{cn_msg})." end |
#is_ok? ⇒ Boolean Also known as: ok?
12 13 14 |
# File 'lib/dingtalk/handler/result_handler.rb', line 12 def is_ok? code == OK_CODE end |