Class: IntercomExport::Cli

Inherits:
Object
  • Object
show all
Defined in:
lib/intercom_export/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(program_name, argv, coordinator_class: IntercomExport::Coordinator, stdout: STDOUT, stderr: STDERR) ⇒ Cli

Returns a new instance of Cli.



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/intercom_export/cli.rb', line 16

def initialize(
  program_name,
  argv,
  coordinator_class: IntercomExport::Coordinator,
  stdout: STDOUT,
  stderr: STDERR
)
  @program_name = program_name
  @argv = argv
  @coordinator_class = coordinator_class
  @stdout = stdout
  @stderr = stderr
end

Instance Method Details

#runObject



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/intercom_export/cli.rb', line 30

def run
  coordinator_class.new(
    source: IntercomExport::Source::IntercomConversations.new(intercom_client),
    splitter: IntercomExport::Splitter::Intercom.new(intercom_client),
    finder: IntercomExport::Finder::IntercomZendesk.new(zendesk_client),
    differ: IntercomExport::Differ::IntercomZendesk.new,
    executor: executor
  ).run
rescue KeyError
  stderr.puts options_parser
end