lib/libis/services/rosetta/client.rb in libis-services-0.0.2 vs lib/libis/services/rosetta/client.rb in libis-services-0.0.3

- old
+ new

@@ -1,14 +1,15 @@ # coding: utf-8 -require 'libis/services/soap_client' +require 'awesome_print' + require 'libis/tools/extend/hash' require 'libis/tools/config' require 'libis/tools/logger' -require 'awesome_print' - +require 'libis/services/soap_client' +require 'libis/services/service_error' module Libis module Services module Rosetta class Client @@ -66,12 +67,12 @@ return data unless data.is_a?(Hash) # check for errors if data.delete :is_error - error data.delete :error_description - return nil + msg = data.delete(:error_description) || data.delete(:message_desc) + raise Libis::Services::ServiceError.new(msg) end # only delete if there is other info. ProducerService isUserExists uses this field as return value. data.delete :error_description if data.size > 1 @@ -93,10 +94,10 @@ data = data.split(/[\s,]+/) if data.is_a?(String) data = [data] if data.is_a?(Hash) data.is_a?(Array) ? data : [] end - def reqeust_object_array(method, klass, args = {}) + def request_object_array(method, klass, args = {}) data = request_array(method, args) data.map { |x| klass.new(x) } end end