Class: AdsCommon::ResultsExtractor
- Inherits:
-
Object
- Object
- AdsCommon::ResultsExtractor
- Defined in:
- lib/ads_common/results_extractor.rb
Instance Method Summary collapse
-
#extract_exception_data(soap_fault, exception_name) ⇒ Object
Extracts misc data from SOAP fault.
-
#extract_header_data(response) ⇒ Object
Extracts misc data from response header.
-
#extract_result(response, action_name) ⇒ Object
Extracts the finest results possible for the given result.
-
#initialize(registry) ⇒ ResultsExtractor
constructor
Instance initializer.
Constructor Details
#initialize(registry) ⇒ ResultsExtractor
Instance initializer.
Args:
- registry: a registry that defines service
30 31 32 |
# File 'lib/ads_common/results_extractor.rb', line 30 def initialize(registry) @registry = registry end |
Instance Method Details
#extract_exception_data(soap_fault, exception_name) ⇒ Object
Extracts misc data from SOAP fault.
55 56 57 58 59 60 |
# File 'lib/ads_common/results_extractor.rb', line 55 def extract_exception_data(soap_fault, exception_name) exception_type = get_full_type_signature(exception_name) process_attributes(soap_fault, false) soap_fault = normalize_fields(soap_fault, exception_type[:fields]) return soap_fault end |
#extract_header_data(response) ⇒ Object
Extracts misc data from response header.
46 47 48 49 50 51 52 |
# File 'lib/ads_common/results_extractor.rb', line 46 def extract_header_data(response) header_type = get_full_type_signature(:SoapResponseHeader) headers = response.header[:response_header].dup process_attributes(headers, false) headers = normalize_fields(headers, header_type[:fields]) return headers end |
#extract_result(response, action_name) ⇒ Object
Extracts the finest results possible for the given result. Returns the response itself in worst case (contents unknown).
36 37 38 39 40 41 42 43 |
# File 'lib/ads_common/results_extractor.rb', line 36 def extract_result(response, action_name) method = @registry.get_method_signature(action_name) action = method[:output][:name].to_sym result = response.to_hash result = result[action] if result.include?(action) result = normalize_output(result, method) return result[:rval] || result end |