Class: LocalSearchService::LocalSearchResponse
- Inherits:
-
BasicResponse
- Object
- BasicResponse
- LocalSearchService::LocalSearchResponse
- Defined in:
- lib/local_search_service/local_search_response.rb
Instance Attribute Summary collapse
-
#search_result ⇒ Object
Returns the value of attribute search_result.
Attributes inherited from BasicResponse
Instance Method Summary collapse
-
#initialize(response_xml, raise_exception_on_error = true) ⇒ LocalSearchResponse
constructor
Constructor.
- #to_s ⇒ Object
Methods inherited from BasicResponse
Constructor Details
#initialize(response_xml, raise_exception_on_error = true) ⇒ LocalSearchResponse
Constructor.
Parameters
response_xml
-
Xml as returned by a
ip_location
-method call. raise_exception_on_error
-
Xml as returned by a
call_status
-method call.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/local_search_service/local_search_response.rb', line 13 def initialize(response_xml, raise_exception_on_error = true) doc = response_xml.document @error_code = LocalSearchService.xpath_query(doc, "statusCode").to_s @error_message = LocalSearchService.xpath_query(doc, "statusMessage").to_s #TODO @search_result = LocalSearchService.xpath_query(doc, "searchResult/RESULTS") raise_on_error(response_xml) if raise_exception_on_error end |
Instance Attribute Details
#search_result ⇒ Object
Returns the value of attribute search_result.
6 7 8 |
# File 'lib/local_search_service/local_search_response.rb', line 6 def search_result @search_result end |
Instance Method Details
#to_s ⇒ Object
26 27 28 |
# File 'lib/local_search_service/local_search_response.rb', line 26 def to_s "#{@error_code.to_s}: #{@error_message.to_s}: #{@search_result.to_s}" end |