Class: Outhad::Integrations::Destination::Zendesk::Client

Inherits:
DestinationConnector
  • Object
show all
Includes:
Core::RateLimiter
Defined in:
lib/outhad/integrations/destination/zendesk/client.rb

Instance Method Summary collapse

Instance Method Details

#check_connection(connection_config) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/outhad/integrations/destination/zendesk/client.rb', line 10

def check_connection(connection_config)
  connection_config = connection_config.with_indifferent_access
  initialize_client(connection_config)
  authenticate_client
  success_status
rescue StandardError => e
  handle_exception(e, {
                     context: "ZENDESK:CHECK_CONNECTION:EXCEPTION",
                     type: "error"
                   })
  failure_status(e)
end

#discover(_connection_config = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/outhad/integrations/destination/zendesk/client.rb', line 23

def discover(_connection_config = nil)
  catalog = build_catalog(load_catalog)
  catalog.to_outhad_message
rescue StandardError => e
  handle_exception(e, {
                     context: "ZENDESK:DISCOVER:EXCEPTION",
                     type: "error"
                   })
  failure_status(e)
end

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



34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/outhad/integrations/destination/zendesk/client.rb', line 34

def write(sync_config, records, action = "create")
  @sync_config = sync_config
  @action = sync_config.stream.action || action
  initialize_client(sync_config.destination.connection_specification)
  process_records(records, sync_config.stream)
rescue StandardError => e
  handle_exception(e, {
                     context: "ZENDESK:WRITE:EXCEPTION",
                     type: "error",
                     sync_id: @sync_config.sync_id,
                     sync_run_id: @sync_config.sync_run_id
                   })
  failure_status(e)
end