diff --git a/lib/gus_bir1.rb b/lib/gus_bir1.rb index 80bd638..1a9d551 100644 --- a/lib/gus_bir1.rb +++ b/lib/gus_bir1.rb @@ -19,8 +19,8 @@ class << self def_delegators :client, :production, :client_key, :service_status, :session_status, :status_date_state, :find_by, :find_and_get_full_data, - :get_full_data - def_delegators :client, :production=, :client_key=, :log_level=, :logging= + :get_full_data, :savon_adapter + def_delegators :client, :production=, :client_key=, :log_level=, :logging=, :savon_adapter= def service_available? client.service_status.to_i == 1 diff --git a/lib/gus_bir1/client.rb b/lib/gus_bir1/client.rb index 63cebfb..01aab89 100644 --- a/lib/gus_bir1/client.rb +++ b/lib/gus_bir1/client.rb @@ -3,7 +3,7 @@ module GusBir1 class Client SESSION_TIMEOUT = 3600 - attr_accessor :production, :client_key, :log_level, :logging + attr_accessor :production, :client_key, :log_level, :logging, :savon_adapter def service_status v = get_value(Constants::PARAM_PARAM_NAME => Constants::PARAM_SERVICE_STATUS) @@ -58,7 +58,7 @@ def get_full_data_from_response(hash) end def find_and_get_full_data(hash) - r = find_by(hash) + r = find_by(**hash) r.map { |h| get_full_data_from_response(h) } end @@ -85,7 +85,7 @@ def endpoint def method_missing(method, *args) if savon_client.operations.include? method - response_hash = call(method, args[0]).hash + response_hash = call(method, args[0]).full_hash response_hash.dig(:envelope, :body, "#{method}_response".to_sym, "#{method}_result".to_sym) else super @@ -149,7 +149,8 @@ def savon_options(publ: false) multipart: true, log_level: @log_level, log: @logging, - proxy: ENV['GUS_BIR_PROXY_URL'] + proxy: ENV['GUS_BIR_PROXY_URL'], + adapter: adapter } if defined?(@sid) && @sid.nil? == false params.merge!({headers: { sid: @sid } }) @@ -157,6 +158,10 @@ def savon_options(publ: false) params end + def adapter + @savon_adapter || :net_http + end + def clear_savon_clients @savon_client = nil @savon_client_publ = nil diff --git a/lib/gus_bir1/version.rb b/lib/gus_bir1/version.rb index b6420d0..e21b0e2 100644 --- a/lib/gus_bir1/version.rb +++ b/lib/gus_bir1/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module GusBir1 - VERSION = '1.1.0' + VERSION = '1.1.1' end