Class: Multiwoven::Integrations::Source::GoogleDrive::Client
- Inherits:
-
UnstructuredSourceConnector
- Object
- UnstructuredSourceConnector
- Multiwoven::Integrations::Source::GoogleDrive::Client
- Defined in:
- lib/multiwoven/integrations/source/google_drive/client.rb
Instance Method Summary collapse
- #check_connection(connection_config) ⇒ Object
- #discover(connection_config) ⇒ Object
- #read(sync_config) ⇒ Object
Instance Method Details
#check_connection(connection_config) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/multiwoven/integrations/source/google_drive/client.rb', line 12 def check_connection(connection_config) connection_config = connection_config.with_indifferent_access 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 success_status rescue StandardError, NotImplementedError => e failure_status(e) end |
#discover(connection_config) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/multiwoven/integrations/source/google_drive/client.rb', line 27 def discover(connection_config) connection_config = connection_config.with_indifferent_access streams = if unstructured_data?(connection_config) [create_unstructured_stream] elsif semistructured_data?(connection_config) [create_semistructured_stream] else raise NotImplementedError, "Discovery failed: Structured data is not supported yet" end catalog = Catalog.new(streams: streams) catalog. rescue StandardError, NotImplementedError => e handle_exception(e, { context: "GOOGLE_DRIVE:DISCOVER:EXCEPTION", type: "error" }) end |
#read(sync_config) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/multiwoven/integrations/source/google_drive/client.rb', line 45 def read(sync_config) connection_config = sync_config.source.connection_specification.with_indifferent_access return handle_unstructured_data(sync_config) if unstructured_data?(connection_config) || semistructured_data?(connection_config) raise NotImplementedError, "Read failed: Structured data is not supported yet" rescue StandardError, NotImplementedError => e handle_exception(e, { context: "GOOGLE_DRIVE:READ:EXCEPTION", type: "error", sync_id: sync_config.sync_id, sync_run_id: sync_config.sync_run_id }) end |