Class: Pilot::TesterExporter
- Defined in:
- lib/pilot/tester_exporter.rb
Instance Method Summary collapse
Methods inherited from Manager
#app, #config, #fetch_app_id, #fetch_app_identifier, #login, #start
Instance Method Details
#export_testers(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/pilot/tester_exporter.rb', line 5 def export_testers() raise "Export file path is required".red unless [:testers_file_path] start() require 'csv' testers = Spaceship::Tunes::Tester::External.all file = config[:testers_file_path] CSV.open(file, "w") do |csv| csv << ['First', 'Last', 'Email', 'Devices', 'Groups', 'Installed Version', 'Install Date'] testers.each do |tester| groups = tester.raw_data.get("groups") group_names = "" if groups && groups.length > 0 names = groups.map { |group| group["name"]["value"] } group_names = names.join(';') end csv << [tester.first_name, tester.last_name, tester.email, tester.devices.count, group_names] end Helper.log.info "Successfully exported CSV to #{file}".green end end |