Class: SoqlDashboard::SoqlExecutor

Inherits:
Object
  • Object
show all
Defined in:
app/services/soql_dashboard/soql_executor.rb

Instance Method Summary collapse

Constructor Details

#initialize(integration) ⇒ SoqlExecutor

Returns a new instance of SoqlExecutor.



5
6
7
8
# File 'app/services/soql_dashboard/soql_executor.rb', line 5

def initialize(integration)
  @integration = integration
  @config = integration.send(config_method_name)
end

Instance Method Details

#call(query) ⇒ Object



10
11
12
13
14
15
16
17
# File 'app/services/soql_dashboard/soql_executor.rb', line 10

def call(query)
  validate_query(query)

  api_client = SoqlDashboard::SalesforceApiClient.new(config)
  api_client.execute_query(query)
rescue StandardError => e
  { error: e.message }
end