Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions integrations/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ GIT
PATH
remote: .
specs:
<<<<<<< HEAD
multiwoven-integrations (0.34.5)
=======
multiwoven-integrations (0.34.10)
>>>>>>> d59fca3c (fix(CE): handles error when downloading file from drive with backslashes (#1471))
MailchimpMarketing
activesupport
async-websocket
Expand Down
4 changes: 4 additions & 0 deletions integrations/lib/multiwoven/integrations/rollout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

module Multiwoven
module Integrations
<<<<<<< HEAD
VERSION = "0.34.5"
=======
VERSION = "0.34.10"
>>>>>>> d59fca3c (fix(CE): handles error when downloading file from drive with backslashes (#1471))

ENABLED_SOURCES = %w[
Snowflake
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@ module GoogleDrive
class Client < SourceConnector
def check_connection(connection_config)
connection_config = connection_config.with_indifferent_access
<<<<<<< HEAD
client = create_connection(connection_config)
build_query(client)
=======

if unstructured_data?(connection_config) || semistructured_data?(connection_config)
create_drive_connection(connection_config)
folder_name = connection_config[:folder_name]
build_query(folder_name)
else
create_connection(connection_config)
end
>>>>>>> d59fca3c (fix(CE): handles error when downloading file from drive with backslashes (#1471))
success_status
rescue StandardError => e
failure_status(e)
Expand Down Expand Up @@ -120,6 +131,7 @@ def start_expense_analysis(file_name, temp_file)
}
)

<<<<<<< HEAD
job_id = resp.job_id
all_pages = []
next_token = nil
Expand All @@ -140,6 +152,18 @@ def start_expense_analysis(file_name, temp_file)
else
sleep 2 # still IN_PROGRESS; wait briefly and try again
end
=======
case command
when LIST_FILES_CMD
list_files_in_folder(folder_name)
when /^#{DOWNLOAD_FILE_CMD}\s+(.+)$/
file_name = ::Regexp.last_match(1).strip
file_name = file_name.gsub(/^["']|["']$/, "") # Remove leading/trailing quotes
file_name = file_name.gsub("\\", "\\\\\\") # Escape backslashes
download_file_to_local(file_name, sync_config.sync_id)
else
raise ArgumentError, "Invalid command. Supported commands: #{LIST_FILES_CMD}, #{DOWNLOAD_FILE_CMD} <file_path>"
>>>>>>> d59fca3c (fix(CE): handles error when downloading file from drive with backslashes (#1471))
end
all_pages
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
RSpec.describe Multiwoven::Integrations::Source::GoogleDrive::Client do
let(:client) { described_class.new }
let(:fields) { "files(id, name, parents, mimeType), nextPageToken" }
<<<<<<< HEAD
let(:error_instance) { StandardError.new("Google Drive source error") }
let(:amazon_textract_exception) { Aws::Textract::Errors::UnsupportedDocumentException.new(nil, "Document format not supported.") }

let(:connection_config) do
=======
let(:credentials) do
>>>>>>> d59fca3c (fix(CE): handles error when downloading file from drive with backslashes (#1471))
{
credentials_json: {
type: "service_account",
Expand Down Expand Up @@ -127,6 +131,7 @@
let(:expense_file) { Google::Apis::DriveV3::File.new(id: "1", name: "expense_file.pdf") }
let(:specified_folder) { Google::Apis::DriveV3::File.new(id: "2", name: "folder") }

<<<<<<< HEAD
before do
client.instance_variable_set(:@options, connection_config[:options])
allow(client).to receive(:create_connection).and_return(google_drive_service)
Expand All @@ -140,6 +145,21 @@
allow(google_drive_service).to receive(:list_files)
.with({ fields: fields, include_items_from_all_drives: true, supports_all_drives: true, page_size: 1, q: "mimeType != 'application/vnd.google-apps.folder'" })
.and_return(Google::Apis::DriveV3::FileList.new(files: [expense_file]))
=======
describe "#check_connection" do
before do
allow(Google::Apis::DriveV3::DriveService).to receive(:new).and_return(google_drive_service)
allow(Google::Auth::ServiceAccountCredentials).to receive(:make_creds).and_return(nil)
allow(google_drive_service).to receive(:authorization=).and_return(nil)
allow(google_drive_service).to receive(:list_files).and_return(file_list)
end
context "when checking structured data connection" do
it "throws a not implemented error" do
message = client.check_connection(sync_config[:source][:connection_specification])
result = message.connection_status
expect(result.status).to eq("failed")
expect(result.message).to include("Connection failed: Structured data is not supported yet")
>>>>>>> d59fca3c (fix(CE): handles error when downloading file from drive with backslashes (#1471))
end
it "returns a successful connection status" do
message = client.check_connection(connection_config)
Expand Down
Loading