Class: Awsum::S3::Bucket

Inherits:
Object show all
Defined in:
lib/awsum/s3/bucket.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(s3, name, creation_date = nil) ⇒ Bucket

Returns a new instance of Bucket.



8
9
10
11
12
# File 'lib/awsum/s3/bucket.rb', line 8

def initialize(s3, name, creation_date = nil)
  @s3 = s3
  @name = name
  @creation_date = creation_date
end

Instance Attribute Details

#creation_dateObject (readonly)

Returns the value of attribute creation_date.



6
7
8
# File 'lib/awsum/s3/bucket.rb', line 6

def creation_date
  @creation_date
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/awsum/s3/bucket.rb', line 6

def name
  @name
end

Instance Method Details

#deleteObject

Delete this Bucket



15
16
17
# File 'lib/awsum/s3/bucket.rb', line 15

def delete
  @s3.delete_bucket(@name)
end

#delete!Object

Delete this Bucket, recursively deleting all keys first



20
21
22
23
24
25
# File 'lib/awsum/s3/bucket.rb', line 20

def delete!
  @s3.keys(@name).each do |key|
    key.delete
  end
  delete
end