Class: Multiwoven::Integrations::Source::Aisquared::Client
- Inherits:
-
SourceConnector
- Object
- SourceConnector
- Multiwoven::Integrations::Source::Aisquared::Client
- Defined in:
- lib/multiwoven/integrations/source/aisquared/client.rb
Defined Under Namespace
Classes: AisquaredError
Instance Method Summary collapse
- #check_connection(connection_config) ⇒ Object
- #discover(_connection_config = nil) ⇒ Object
- #read(sync_config) ⇒ Object
Instance Method Details
#check_connection(connection_config) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/multiwoven/integrations/source/aisquared/client.rb', line 9 def check_connection(connection_config) response = make_request(, HTTP_POST, connection_config[:request_format], connection_config) success?(response) ? success_status : failure_status(nil) rescue StandardError => e handle_exception(e, { context: "AISQUARED_LIGHTNING_ENDPOINT:CHECK_CONNECTION:EXCEPTION", type: "error" }) failure_status(e) end |
#discover(_connection_config = nil) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/multiwoven/integrations/source/aisquared/client.rb', line 17 def discover(_connection_config = nil) catalog_json = read_json(CATALOG_SPEC_PATH) catalog = build_catalog(catalog_json) catalog. rescue StandardError => e handle_exception(e, { context: "AISQUARED_LIGHTNING_ENDPOINT:DISCOVER:EXCEPTION", type: "error" }) end |
#read(sync_config) ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/multiwoven/integrations/source/aisquared/client.rb', line 25 def read(sync_config) # The server checks the ConnectorQueryType. # If it's "ai_ml," the server calculates the payload and passes it as a query in the sync config model protocol. # This query is then sent to the AI/ML model. connection_config = sync_config.source.connection_specification payload = sync_config.model.query run_model(connection_config, payload) rescue StandardError => e handle_exception(e, { context: "AISQUARED_LIGHTNING_ENDPOINT:READ:EXCEPTION", type: "error" }) end |