Project

General

Profile

Revision c06f1783

Added by Thomas McKay over 6 years ago

fixes #15743 - import and export of subscriptions one-per-line

View differences:

lib/hammer_cli_csv/subscriptions.rb
16 16
      CONTRACT = 'Contract Number'
17 17
      ACCOUNT = 'Account Number'
18 18

  
19
      def export
20
        CSV.open(option_file || '/dev/stdout', 'wb', {:force_quotes => false}) do |csv|
21
          csv << [NAME, ORGANIZATION, MANIFEST, SUBSCRIPTION, QUANTITY, SKU, CONTRACT, ACCOUNT]
22
          @api.resource(:organizations).call(:index, {:per_page => 999999})['results'].each do |organization|
23
            next if option_organization && organization['name'] != option_organization
24
            organization = @api.resource(:organizations).call(:show, {'id' => organization['id']})
25
            export_manifest(csv, organization)
26
            export_subscriptions(csv, organization)
27
          end
19
      def export(csv)
20
        csv << [NAME, ORGANIZATION, MANIFEST, SUBSCRIPTION, QUANTITY, SKU, CONTRACT, ACCOUNT]
21
        @api.resource(:organizations).call(:index, {:per_page => 999999})['results'].each do |organization|
22
          next if option_organization && organization['name'] != option_organization
23
          organization = @api.resource(:organizations).call(:show, {'id' => organization['id']})
24
          export_manifest(csv, organization)
25
          export_subscriptions(csv, organization)
28 26
        end
29 27
      end
30 28

  

Also available in: Unified diff