Class: DB2Fog::FogStore

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

Instance Method Summary collapse

Instance Method Details

#delete(remote_filename) ⇒ Object



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

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

#fetch(remote_filename) ⇒ Object



183
184
185
186
187
188
189
# File 'lib/db2fog.rb', line 183

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



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

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

#store(remote_filename, io) ⇒ Object



179
180
181
# File 'lib/db2fog.rb', line 179

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