Class: DB2Fog::FogStore

Inherits:
Object
  • Object
show all
Defined in:
lib/db2fog.rb

Instance Method Summary collapse

Instance Method Details

#delete(remote_filename) ⇒ Object



207
208
209
210
# File 'lib/db2fog.rb', line 207

def delete(remote_filename)
  remote_file = directory.files.head(remote_filename)
  remote_file.destroy if remote_file
end

#fetch(remote_filename) ⇒ Object



195
196
197
198
199
200
201
# File 'lib/db2fog.rb', line 195

def fetch(remote_filename)
  remote_file = directory.files.get(remote_filename)

  file = Tempfile.new("dump")
  open(file.path, 'wb') { |f| f.write(remote_file.body) }
  file
end

#listObject



203
204
205
# File 'lib/db2fog.rb', line 203

def list
  directory.files.map { |f| f.key }
end

#store(remote_filename, io) ⇒ Object



191
192
193
# File 'lib/db2fog.rb', line 191

def store(remote_filename, io)
  directory.files.create(:key => remote_filename, :body => io, :public => false)
end