Class: Fog::AWS::S3::Buckets

Inherits:
Collection show all
Defined in:
lib/fog/aws/models/s3/buckets.rb

Instance Method Summary collapse

Methods inherited from Collection

#initialize, #inspect, #update_attributes

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/aws/models/s3/buckets.rb', line 11

def all
  data = connection.get_service.body
  owner = Fog::AWS::S3::Owner.new(data.delete('Owner').merge!(:connection => connection))
  buckets = []
  data['Buckets'].each do |bucket|
    buckets << Fog::AWS::S3::Bucket.new({
      :connection     => connection,
      :owner          => owner
    }.merge!(bucket))
  end
  buckets
end

#create(attributes = {}) ⇒ Object



24
25
26
27
28
# File 'lib/fog/aws/models/s3/buckets.rb', line 24

def create(attributes = {})
  bucket = new(attributes)
  bucket.save
  bucket
end

#new(attributes = {}) ⇒ Object



30
31
32
# File 'lib/fog/aws/models/s3/buckets.rb', line 30

def new(attributes = {})
  Fog::AWS::S3::Bucket.new(attributes.merge!(:connection => connection))
end