Class: Intacct::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/intacct/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http_response) ⇒ Response

Returns a new instance of Response.



8
9
10
11
12
13
# File 'lib/intacct/response.rb', line 8

def initialize(http_response)
  @response_body = Nokogiri::XML(http_response.body)

  # raises an error unless the response is in the 2xx range.
  http_response.value
end

Instance Attribute Details

#response_bodyObject (readonly)

Returns the value of attribute response_body.



6
7
8
# File 'lib/intacct/response.rb', line 6

def response_body
  @response_body
end

Instance Method Details

#get_authentication_resultObject



24
25
26
# File 'lib/intacct/response.rb', line 24

def get_authentication_result
  Intacct::AuthenticationResult.new(@response_body.xpath('//response/operation/authentication'))
end

#get_function_result(control_id) ⇒ Object



19
20
21
22
# File 'lib/intacct/response.rb', line 19

def get_function_result(control_id)
  @function_results ||= build_function_results
  @function_results[control_id.to_s]
end

#successful?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/intacct/response.rb', line 15

def successful?
  @response_body.xpath('//response/control/status').text == 'success'
end