Class: Etl::Integrations::Source::ZohoBooks::Client

Inherits:
DestinationConnector
  • Object
show all
Includes:
Core::RateLimiter
Defined in:
lib/etl/integrations/source/zoho_books/client.rb

Instance Method Summary collapse

Instance Method Details

#check_connection(connection_config) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/etl/integrations/source/zoho_books/client.rb', line 15

def check_connection(connection_config)
  connection_config = connection_config.with_indifferent_access
  puts "connection_config zoho books: #{connection_config}"
  create_connection(connection_config)
  # authenticate_client
  success_status
rescue StandardError => e
  handle_exception("ZOHO:BOOKS:DISCOVER:EXCEPTION:check_connection", "error", e)
  failure_status(e)
end

#discover(_connection_config = nil) ⇒ Object



26
27
28
29
30
31
# File 'lib/etl/integrations/source/zoho_books/client.rb', line 26

def discover(_connection_config = nil)
  catalog = build_catalog(load_catalog)
  catalog.to_multiwoven_message
rescue StandardError => e
  handle_exception("ZOHO:BOOKS:DISCOVER:EXCEPTION:discover", "error", e)
end

#write(sync_config, records, action = "create") ⇒ Object



33
34
35
36
37
38
39
# File 'lib/etl/integrations/source/zoho_books/client.rb', line 33

def write(sync_config, records, action = "create")
  @action = sync_config.stream.action || action
  create_connection(sync_config.destination.connection_specification)
  process_records(records, sync_config.stream)
rescue StandardError => e
  handle_exception("ZOHO:BOOKS:WRITE:EXCEPTION:write", "error", e)
end