Sha256: 022acab2739333d3958a890ad5ac70c504ee1b33a5ff99ef43a953392f1a2a9f

Contents?: true

Size: 1.05 KB

Versions: 19

Compression:

Stored size: 1.05 KB

Contents

#!/usr/bin/env ruby -rubygems

require File.join(File.dirname(__FILE__), '..', 'lib', 'storage_room')

collection_path = ::File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec', 'fixtures', 'export_collection.json'))
entry_path      = ::File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec', 'fixtures', 'export_entries.json'))
download_path   = ::File.expand_path(File.join(File.dirname(__FILE__), 'downloads'))

collection = StorageRoom::Resource.new_from_json_file(collection_path)
entry_class = collection.entry_class

attachment_fields = collection.fields.select{|f| f.is_a?(StorageRoom::AttachmentField)}

puts "Loaded Collection '#{collection.name}' with attachment fields: #{attachment_fields.map(&:name).join(', ')}"
puts "Downloading into '#{download_path}'"

StorageRoom::Array.new_from_json_file(entry_path).resources.each do |entry|
  attachment_fields.each do |field|
    if file = entry.send(field.identifier)  
      puts "Downloading #{file[:@url]} including all versions"
      file.download_to_directory(download_path)
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
storage_room-0.3.24 examples/backup_uploads_from_export.rb
storage_room-0.3.23 examples/backup_uploads_from_export.rb
storage_room-0.3.22 examples/backup_uploads_from_export.rb
storage_room-0.3.21 examples/backup_uploads_from_export.rb
storage_room-0.3.20 examples/backup_uploads_from_export.rb
storage_room-0.3.19 examples/backup_uploads_from_export.rb
storage_room-0.3.18 examples/backup_uploads_from_export.rb
storage_room-0.3.17 examples/backup_uploads_from_export.rb
storage_room-0.3.16 examples/backup_uploads_from_export.rb
storage_room-0.3.15 examples/backup_uploads_from_export.rb
storage_room-0.3.14 examples/backup_uploads_from_export.rb
storage_room-0.3.13 examples/backup_uploads_from_export.rb
storage_room-0.3.12 examples/backup_uploads_from_export.rb
storage_room-0.3.11 examples/backup_uploads_from_export.rb
storage_room-0.3.10 examples/backup_uploads_from_export.rb
storage_room-0.3.9 examples/backup_uploads_from_export.rb
storage_room-0.3.8 examples/backup_uploads_from_export.rb
storage_room-0.3.7 examples/backup_uploads_from_export.rb
storage_room-0.3.6 examples/backup_uploads_from_export.rb