Class: Gemgate::Storage::S3

Inherits:
Object
  • Object
show all
Defined in:
lib/gemgate/storage/s3.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

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