class Duracloud::Commands::FindItems

Constants

HEADERS

Public Instance Methods

call() click to toggle source
# File lib/duracloud/commands/find_items.rb, line 8
def call
  CSV.instance($stdout, headers: HEADERS, write_headers: true) do |csv|
    CSV.foreach(infile, headers: false) do |row|
      begin
        item = Duracloud::Content.find(space_id: space_id, store_id: store_id, content_id: row[0], md5: row[1])
        csv << HEADERS.map { |header| item.send(header) }
      rescue Duracloud::NotFoundError, Duracloud::MessageDigestError => e
        $stderr.puts "ERROR: Content ID #{row[0]} -- #{e.message}"
      end
    end
  end
end