Class: Agris::ProcessMessageResponse::ErrorInfo
- Inherits:
-
Object
- Object
- Agris::ProcessMessageResponse::ErrorInfo
- Defined in:
- lib/agris/process_message_response.rb
Instance Method Summary collapse
-
#initialize(hash) ⇒ ErrorInfo
constructor
A new instance of ErrorInfo.
- #payload ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(hash) ⇒ ErrorInfo
Returns a new instance of ErrorInfo.
29 30 31 |
# File 'lib/agris/process_message_response.rb', line 29 def initialize(hash) @hash = hash end |
Instance Method Details
#payload ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/agris/process_message_response.rb', line 33 def payload if @hash.key?('xml') @hash['xml']['errors']['errorinfo'] elsif @hash['errorinfo'].is_a?(Hash) @hash['errorinfo'] elsif @hash['errorinfo'].is_a?(String) @hash['errorinfo'].strip else @hash end end |
#type ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/agris/process_message_response.rb', line 45 def type @type ||= if @hash.key?('xml') :message elsif @hash['errorinfo'].is_a?(Hash) :system elsif @hash['errorinfo'].is_a?(String) :api else :unknown end end |