Class: Etl::Integrations::Core::BaseConnector

Inherits:
Object
  • Object
show all
Includes:
Constants, Utils, Protocol
Defined in:
lib/etl/integrations/core/base_connector.rb

Direct Known Subclasses

DestinationConnector, SourceConnector

Constant Summary

Constants included from Constants

Constants::AIRTABLE_BASES_ENDPOINT, Constants::AIRTABLE_GET_BASE_SCHEMA_ENDPOINT, Constants::AIRTABLE_URL_BASE, Constants::CATALOG_SPEC_PATH, Constants::CONNECTOR_SPEC_PATH, Constants::DATABRICKS_DRIVER_PATH, Constants::DATABRICKS_MAC_DRIVER_PATH, Constants::FACEBOOK_AUDIENCE_GET_ALL_ACCOUNTS, Constants::GOOGLE_SHEETS_SCOPE, Constants::GOOGLE_SPREADSHEET_ID_REGEX, Constants::HTTP_DELETE, Constants::HTTP_GET, Constants::HTTP_POST, Constants::HTTP_PUT, Constants::JSON_SCHEMA_URL, Constants::KLAVIYO_AUTH_ENDPOINT, Constants::KLAVIYO_AUTH_PAYLOAD, Constants::META_DATA_PATH, Constants::SNOWFLAKE_DRIVER_PATH, Constants::SNOWFLAKE_MAC_DRIVER_PATH

Constants included from Protocol

Protocol::ConnectionStatusType, Protocol::ConnectorQueryType, Protocol::ConnectorType, Protocol::ControlMessageType, Protocol::DestinationSyncMode, Protocol::LogLevel, Protocol::ModelQueryType, Protocol::MultiwovenMessageType, Protocol::RequestRateLimitingUnit, Protocol::SchemaMode, Protocol::StreamAction, Protocol::StreamType, Protocol::SyncMode, Protocol::SyncStatus

Instance Method Summary collapse

Methods included from Utils

#build_catalog, #build_stream, #convert_to_json_schema, #create_log_message, #extract_data, #handle_exception, #keys_to_symbols, #logger, #map_type_to_json_schema, #success?

Instance Method Details

#check_connection(_connection_config) ⇒ Object

Connection config is a hash



37
38
39
40
# File 'lib/etl/integrations/core/base_connector.rb', line 37

def check_connection(_connection_config)
  raise "Not implemented"
  # returns Protocol.ConnectionStatus
end

#connector_specObject



10
11
12
13
14
15
16
# File 'lib/etl/integrations/core/base_connector.rb', line 10

def connector_spec
  @connector_spec ||= begin
    spec_json = keys_to_symbols(read_json(CONNECTOR_SPEC_PATH)).to_json
    # returns Protocol::ConnectorSpecification
    ConnectorSpecification.from_json(spec_json)
  end
end

#discover(_connection_config) ⇒ Object

Connection config is a hash



43
44
45
46
# File 'lib/etl/integrations/core/base_connector.rb', line 43

def discover(_connection_config)
  raise "Not implemented"
  # returns Protocol::Catalog
end

#meta_dataObject



18
19
20
21
22
23
24
25
# File 'lib/etl/integrations/core/base_connector.rb', line 18

def 
   = read_json(META_DATA_PATH).deep_symbolize_keys
  icon_name = [:data][:icon]
  icon_url = "https://raw.githubusercontent.com/Etl/multiwoven/main/integrations#{relative_path}/#{icon_name}"
  [:data][:icon] = icon_url
  # returns hash
  @meta_data ||= 
end

#relative_pathObject



27
28
29
30
31
32
33
34
# File 'lib/etl/integrations/core/base_connector.rb', line 27

def relative_path
  path = Object.const_source_location(self.class.to_s)[0]
  connector_folder = File.dirname(path)
  marker = "/lib/multiwoven/integrations/"
  parts = connector_folder.split(marker)

  marker + parts.last if parts.length > 1
end