Class: Intacct::Response
- Inherits:
-
Object
- Object
- Intacct::Response
- Defined in:
- lib/intacct/response.rb
Instance Attribute Summary collapse
-
#response_body ⇒ Object
readonly
Returns the value of attribute response_body.
Instance Method Summary collapse
- #get_authentication_result ⇒ Object
- #get_function_result(control_id) ⇒ Object
-
#initialize(http_response) ⇒ Response
constructor
A new instance of Response.
- #successful? ⇒ Boolean
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_body ⇒ Object (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_result ⇒ Object
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
15 16 17 |
# File 'lib/intacct/response.rb', line 15 def successful? @response_body.xpath('//response/control/status').text == 'success' end |