Class: Agris::ProcessMessageResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/agris/process_message_response.rb

Defined Under Namespace

Classes: ErrorInfo

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(result, ag_output_obj_p, ag_error_str_p) ⇒ ProcessMessageResponse

Returns a new instance of ProcessMessageResponse.



6
7
8
9
10
# File 'lib/agris/process_message_response.rb', line 6

def initialize(result, ag_output_obj_p, ag_error_str_p)
  @result = result
  @ag_output_obj_p = ag_output_obj_p
  @ag_error_str_p = ag_error_str_p
end

Instance Attribute Details

#ag_error_str_pObject

Returns the value of attribute ag_error_str_p.



4
5
6
# File 'lib/agris/process_message_response.rb', line 4

def ag_error_str_p
  @ag_error_str_p
end

#ag_output_obj_pObject

Returns the value of attribute ag_output_obj_p.



4
5
6
# File 'lib/agris/process_message_response.rb', line 4

def ag_output_obj_p
  @ag_output_obj_p
end

#resultObject

Returns the value of attribute result.



4
5
6
# File 'lib/agris/process_message_response.rb', line 4

def result
  @result
end

Instance Method Details

#error?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/agris/process_message_response.rb', line 12

def error?
  !ag_error_str_p.to_s.strip.empty?
end

#error_hashObject



20
21
22
# File 'lib/agris/process_message_response.rb', line 20

def error_hash
  @error_hash ||= error? ? Hash.from_xml(ag_error_str_p) : {}
end

#error_infoObject



16
17
18
# File 'lib/agris/process_message_response.rb', line 16

def error_info
  @error_info ||= error? ? ErrorInfo.new(error_hash) : nil
end

#output_hashObject



24
25
26
# File 'lib/agris/process_message_response.rb', line 24

def output_hash
  @output_hash ||= Hash.from_xml(ag_output_obj_p)
end