1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/aws/models/s3/buckets.rb

39 lines
874 B
Ruby
Raw Normal View History

2009-08-02 19:37:54 -04:00
module Fog
module AWS
class S3
def buckets
Fog::AWS::S3::Buckets.new(:connection => self)
end
class Buckets < Fog::Collection
def all
data = connection.get_service.body
2009-08-04 13:51:54 -04:00
owner = Fog::AWS::S3::Owner.new(data.delete('Owner').merge!(:connection => connection))
2009-08-02 19:37:54 -04:00
buckets = []
data['Buckets'].each do |bucket|
buckets << Fog::AWS::S3::Bucket.new({
:connection => connection,
:owner => owner
2009-08-04 13:51:54 -04:00
}.merge!(bucket))
2009-08-02 19:37:54 -04:00
end
buckets
end
2009-08-04 01:50:52 -04:00
def create(attributes = {})
bucket = new(attributes)
bucket.save
bucket
end
def new(attributes = {})
Fog::AWS::S3::Bucket.new(attributes.merge!(:connection => connection))
end
2009-08-02 19:37:54 -04:00
end
end
end
end