diff --git a/integrations/lib/multiwoven/integrations/destination/http/client.rb b/integrations/lib/multiwoven/integrations/destination/http/client.rb index c57a2947..e218286d 100644 --- a/integrations/lib/multiwoven/integrations/destination/http/client.rb +++ b/integrations/lib/multiwoven/integrations/destination/http/client.rb @@ -8,7 +8,7 @@ module Http class Client < DestinationConnector MAX_CHUNK_SIZE = 10 def check_connection(connection_config) - connection_config = connection_config[:connection_specification].with_indifferent_access + connection_config = connection_config.with_indifferent_access destination_url = connection_config[:destination_url] headers = connection_config[:headers] request = Multiwoven::Integrations::Core::HttpClient.request( @@ -17,6 +17,7 @@ def check_connection(connection_config) payload: {}, headers: headers ) + if success?(request) success_status else @@ -41,7 +42,6 @@ def discover(_connection_config = nil) def write(sync_config, records, _action = "create") connection_config = sync_config.destination.connection_specification.with_indifferent_access - url = connection_config[:destination_url] headers = connection_config[:headers] write_success = 0 @@ -85,12 +85,6 @@ def create_payload(records) } end - def convert_to_auth_key(username, password) - full_string = "#{username}:#{password}" - # need to remove line break after encoding or else request fails - Base64.encode64(full_string).gsub(/\n/, "") - end - def extract_body(response) response_body = response.body JSON.parse(response_body) if response_body diff --git a/integrations/spec/multiwoven/integrations/destination/http/client_spec.rb b/integrations/spec/multiwoven/integrations/destination/http/client_spec.rb index 5e09cea2..1d1e54c0 100644 --- a/integrations/spec/multiwoven/integrations/destination/http/client_spec.rb +++ b/integrations/spec/multiwoven/integrations/destination/http/client_spec.rb @@ -10,11 +10,12 @@ let(:client) { described_class.new } let(:mock_http_session) { double("Net::Http::Session") } let(:connection_config) do - { + { destination_url: "https://www.google.com", headers: { test: "test", test1: "test1" + } }.with_indifferent_access end