Class: TenderImport::ZendeskApiImport

Inherits:
Object
  • Object
show all
Defined in:
lib/tender_import/zendesk_api_import.rb

Overview

Produce a Tender import archive from a ZenDesk site using the ZenDesk API.

You can set TenderImport::ZendeskApiImport::Exporter.html2text_bin to the full path of your html2text binary if you don’t want it in your shell PATH.

Defined Under Namespace

Modules: Log Classes: Client, Error, Exporter

Class Method Summary collapse

Class Method Details

.run(options = nil) ⇒ Object

Produce a complete import archive either from API or command line options.



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'lib/tender_import/zendesk_api_import.rb', line 300

def self.run options=nil
  begin
    client = Client.new options
    exporter = Exporter.new client
    exporter.export_users
    exporter.export_categories
    exporter.export_tickets
    exporter.create_archive
  rescue Error => e
    puts "FAILED WITH AN ERROR"
    puts e.to_s
    exit 1
  ensure
    if exporter
      puts "RESULTS"
      puts exporter.stats.inspect
      puts exporter.report.join("\n")
    end
  end
end