Class: DB2Fog::FogStore
- Inherits:
-
Object
- Object
- DB2Fog::FogStore
- Defined in:
- lib/db2fog.rb
Instance Method Summary collapse
- #delete(remote_filename) ⇒ Object
- #fetch(remote_filename) ⇒ Object
- #list ⇒ Object
- #store(remote_filename, io) ⇒ Object
Instance Method Details
#delete(remote_filename) ⇒ Object
199 200 201 202 |
# File 'lib/db2fog.rb', line 199 def delete(remote_filename) remote_file = directory.files.head(remote_filename) remote_file.destroy if remote_file end |
#fetch(remote_filename) ⇒ Object
187 188 189 190 191 192 193 |
# File 'lib/db2fog.rb', line 187 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 |
#list ⇒ Object
195 196 197 |
# File 'lib/db2fog.rb', line 195 def list directory.files.map { |f| f.key } end |
#store(remote_filename, io) ⇒ Object
183 184 185 |
# File 'lib/db2fog.rb', line 183 def store(remote_filename, io) directory.files.create(:key => remote_filename, :body => io, :public => false) end |