Class: Fog::Storage::GoogleJSON::Directory

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/storage/google_json/models/directory.rb

Overview

Represents a Google Storage bucket

Instance Method Summary collapse

Instance Method Details

#destroyObject


31
32
33
34
35
36
37
38
# File 'lib/fog/storage/google_json/models/directory.rb', line 31

def destroy
  requires :key
  service.delete_bucket(key)
  true
rescue ::Google::Apis::ClientError => e
  raise e unless e.status_code == 404
  false
end

#files(attr = {}) ⇒ Object


40
41
42
43
44
45
46
# File 'lib/fog/storage/google_json/models/directory.rb', line 40

def files(attr = {})
  @files ||= begin
    Fog::Storage::GoogleJSON::Files.new(
      attr.merge(:directory => self, :service => service)
    )
  end
end

#public_urlObject


48
49
50
51
# File 'lib/fog/storage/google_json/models/directory.rb', line 48

def public_url
  requires :key
  "#{GOOGLE_STORAGE_BUCKET_BASE_URL}#{key}"
end

#saveObject


53
54
55
56
57
# File 'lib/fog/storage/google_json/models/directory.rb', line 53

def save
  requires :key
  service.put_bucket(key, attributes)
  true
end