Module: Sndacs::BucketsExtension

Defined in:
lib/sndacs/buckets_extension.rb

Instance Method Summary collapse

Instance Method Details

#build(name) ⇒ Object

Builds new bucket with given name



5
6
7
# File 'lib/sndacs/buckets_extension.rb', line 5

def build(name)
  Bucket.send(:new, proxy_owner, name)
end

#destroy_all(force = false) ⇒ Object

Destroys all buckets in the service. Doesn’t destroy non-empty buckets by default, pass true to force destroy (USE WITH CARE!).



26
27
28
# File 'lib/sndacs/buckets_extension.rb', line 26

def destroy_all(force = false)
  proxy_target.each { |bucket| bucket.destroy(force) }
end

#find_allObject

Finds all buckets in the service



20
21
22
# File 'lib/sndacs/buckets_extension.rb', line 20

def find_all
  proxy_target
end

#find_first(name) ⇒ Object Also known as: find

Finds the bucket with given name



10
11
12
13
14
15
16
# File 'lib/sndacs/buckets_extension.rb', line 10

def find_first(name)
  bucket = build(name)

  bucket.retrieve
rescue Error::NoSuchBucket, Error::ForbiddenBucket
  nil
end