Class: Syncbox::Store
- Inherits:
-
Object
- Object
- Syncbox::Store
- Defined in:
- lib/syncbox/store.rb
Constant Summary collapse
- STORES =
{ "S3" => "S3Bucket", "Glacier" => "Glacier"}
Instance Method Summary collapse
-
#add(file_path) ⇒ Object
(also: #modify)
Add file to store.
-
#delete(file_path) ⇒ Object
delete file from store.
-
#initialize(store, options = {}) ⇒ Store
constructor
Initializes a store object.
Constructor Details
#initialize(store, options = {}) ⇒ Store
Initializes a store object
13 14 15 16 17 |
# File 'lib/syncbox/store.rb', line 13 def initialize(store, ={}) raise ArgumentError, "Store #{store} is not supported." unless STORES.fetch(store) class_name = STORES[store] @store = Object.const_get("Syncbox").const_get(class_name).new() end |
Instance Method Details
#add(file_path) ⇒ Object Also known as: modify
Add file to store.
25 26 27 |
# File 'lib/syncbox/store.rb', line 25 def add(file_path) @store.upload(file_path) end |
#delete(file_path) ⇒ Object
delete file from store.
35 36 37 |
# File 'lib/syncbox/store.rb', line 35 def delete(file_path) @store.delete(file_path) end |