Class: Dingtalk::EcoResultHandler
- Inherits:
-
Object
- Object
- Dingtalk::EcoResultHandler
- Defined in:
- lib/dingtalk/handler/eco_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.
-
#response_name ⇒ Object
Returns the value of attribute response_name.
-
#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(m, response = {}) ⇒ EcoResultHandler
constructor
A new instance of EcoResultHandler.
- #is_ok? ⇒ Boolean (also: #ok?)
- #sub_code ⇒ Object
Constructor Details
#initialize(m, response = {}) ⇒ EcoResultHandler
Returns a new instance of EcoResultHandler.
5 6 7 8 9 |
# File 'lib/dingtalk/handler/eco_result_handler.rb', line 5 def initialize(m, response={}) @response_name = "#{m.gsub(/\./, '_')}_response" @response = package_result(response) @result = @response[@response_name] end |
Instance Attribute Details
#cn_msg ⇒ Object
Returns the value of attribute cn_msg.
3 4 5 |
# File 'lib/dingtalk/handler/eco_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/eco_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/eco_result_handler.rb', line 3 def en_msg @en_msg end |
#response_name ⇒ Object
Returns the value of attribute response_name.
3 4 5 |
# File 'lib/dingtalk/handler/eco_result_handler.rb', line 3 def response_name @response_name end |
#result ⇒ Object
Returns the value of attribute result.
3 4 5 |
# File 'lib/dingtalk/handler/eco_result_handler.rb', line 3 def result @result end |
Instance Method Details
#full_error_message ⇒ Object Also known as: full_error_messages
41 42 43 |
# File 'lib/dingtalk/handler/eco_result_handler.rb', line 41 def if !is_ok? end |
#full_message ⇒ Object Also known as: full_messages
32 33 34 35 36 37 38 |
# File 'lib/dingtalk/handler/eco_result_handler.rb', line 32 def if is_ok? "SUCCESS, Please use #result to get result." else "#{code}: #{en_msg}(#{sub_code}:#{cn_msg})." end end |
#is_ok? ⇒ Boolean Also known as: ok?
11 12 13 |
# File 'lib/dingtalk/handler/eco_result_handler.rb', line 11 def is_ok? @response[:error_response].nil? end |
#sub_code ⇒ Object
28 29 30 |
# File 'lib/dingtalk/handler/eco_result_handler.rb', line 28 def sub_code @response[:error_response][:sub_code] end |