Skip to content

Commit

Permalink
updates to client and client spec
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyR-AI2 committed May 7, 2024
1 parent a084082 commit da5d22b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -17,6 +17,7 @@ def check_connection(connection_config)
payload: {},
headers: headers
)

if success?(request)
success_status
else
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit da5d22b

Please sign in to comment.