Class: Gemgate::Storage::S3
- Inherits:
-
Object
- Object
- Gemgate::Storage::S3
- Defined in:
- lib/gemgate/storage/s3.rb
Defined Under Namespace
Classes: Error
Instance Method Summary collapse
- #create(path, body) ⇒ Object
- #get(path) ⇒ Object
-
#initialize(env = ENV) ⇒ S3
constructor
A new instance of S3.
- #update(path, body) ⇒ Object
Constructor Details
#initialize(env = ENV) ⇒ S3
Returns a new instance of S3.
7 8 9 |
# File 'lib/gemgate/storage/s3.rb', line 7 def initialize(env = ENV) @env = env end |
Instance Method Details
#create(path, body) ⇒ Object
17 18 19 |
# File 'lib/gemgate/storage/s3.rb', line 17 def create(path, body) remote_directory.files.create(:key => prefix(path), :body => body, :acl => "public-read") end |
#get(path) ⇒ Object
11 12 13 14 15 |
# File 'lib/gemgate/storage/s3.rb', line 11 def get(path) if file = remote_directory.files.get(prefix(path)) file.body end end |
#update(path, body) ⇒ Object
21 22 23 |
# File 'lib/gemgate/storage/s3.rb', line 21 def update(path, body) create(path, body) end |