Class: Duracloud::Commands::ListItems

Inherits:
Command
  • Object
show all
Defined in:
lib/duracloud/commands/list_items.rb

Constant Summary collapse

HEADERS =
%i( content_id md5 size content_type modified )

Instance Method Summary collapse

Methods inherited from Command

call, #cli

Instance Method Details

#callObject



8
9
10
11
12
13
14
# File 'lib/duracloud/commands/list_items.rb', line 8

def call
  CSV.instance($stdout, headers: HEADERS, write_headers: true) do |csv|
    Duracloud::Space.items(space_id, store_id: store_id, prefix: prefix).each do |item|
      csv << HEADERS.map { |header| item.send(header) }
    end
  end
end