Class: Etl::Integrations::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/etl/integrations/service.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|self.class.config| ... } ⇒ Service

Returns a new instance of Service.

Yields:



6
7
8
# File 'lib/etl/integrations/service.rb', line 6

def initialize
  yield(self.class.config) if block_given?
end

Class Method Details

.configObject



59
60
61
# File 'lib/etl/integrations/service.rb', line 59

def config
  @config ||= Config.new
end

.connector_class(connector_type, connector_name) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/etl/integrations/service.rb', line 21

def connector_class(connector_type, connector_name) 
  # *args
  Object.const_get(
    "Etl::Integrations::#{connector_type}::#{connector_name}::Client"
  )

  # # Retrieve the class dynamically
  # klass = Object.const_get(
  #   "Etl::Integrations::#{connector_type}::#{connector_name}::Client"
  # )

  # # Instantiate the class (assuming it's not a singleton)
  # client_instance = klass.new

  # # Only apply base_url if connector_name starts with "Zoho" or "zoho"
  # if connector_name.match?(/^Zoho/i)
  #   # Check for base_url in the args
  #   base_url = args.find { |arg| arg.is_a?(String) && arg.start_with?("http") }

  #   # If base_url is found, call the method to set it
  #   if base_url
  #     if client_instance.respond_to?(:setting_base_url)
  #       client_instance.setting_base_url(base_url)
  #     else
  #       raise NoMethodError, "Undefined method `setting_base_url` for #{client_instance.class}"
  #     end
  #   end
  # end

  # # Return the instance for further use
  # klass

end

.connectorsObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/etl/integrations/service.rb', line 10

def connectors
  {
    source: build_connectors(
      ENABLED_SOURCES, "Source"
    ),
    destination: build_connectors(
      ENABLED_DESTINATIONS, "Destination"
    )
  }
end

.loggerObject



55
56
57
# File 'lib/etl/integrations/service.rb', line 55

def logger
  config.logger || default_logger
end