Class: ActiveConnect::ActiveConnectData

Inherits:
ApplicationRecord show all
Includes:
ActiveConnectDataIntegrations::Httparty
Defined in:
app/models/active_connect/active_connect_data.rb

Instance Method Summary collapse

Methods included from ActiveConnectDataIntegrations::Httparty

#httparty_update_data

Instance Method Details

#parse_data(data) ⇒ Object



32
33
34
35
36
37
# File 'app/models/active_connect/active_connect_data.rb', line 32

def parse_data(data)
  return unless connectable.respond_to?(:parse_data)

  # Delegate parsing to the connectable model if it has `parse_data` defined
  connectable.parse_data(data)
end

#update_dataObject

Master method to fetch data from the service



20
21
22
23
24
25
26
27
28
29
30
# File 'app/models/active_connect/active_connect_data.rb', line 20

def update_data
  config = load_service_config  # Load the service-specific configuration
  method_name = "#{config['engine']}_update_data"

  if respond_to?(method_name, true)
    data = send(method_name)
    parse_data(data)
  else
    raise NoMethodError, "No method defined for engine '#{config['engine']}'"
  end
end