Class: Fog::Storage::Softlayer::Directory

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

Instance Method Summary collapse

Instance Method Details

#destroyObject



22
23
24
25
26
27
28
# File 'lib/fog/softlayer/models/storage/directory.rb', line 22

def destroy
  requires :key
  service.delete_container(key)
  true
rescue Excon::Errors::NotFound
  false
end

#filesObject



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

def files
  @files ||= begin
    Fog::Storage::Softlayer::Files.new(
      :directory    => self,
      :service   => service
    )
  end
end

#publicObject Also known as: public?



43
44
45
# File 'lib/fog/softlayer/models/storage/directory.rb', line 43

def public
  !!attributes[:public]
end

#public=(new_public) ⇒ Object



39
40
41
# File 'lib/fog/softlayer/models/storage/directory.rb', line 39

def public=(new_public)
  attributes[:public] = new_public
end

#public_urlObject



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

def public_url
  requires :key
  cluster = service.cluster.downcase
  key = Fog::Softlayer.escape(self.key)
  "http://17532.http.#{cluster}.cdn.softlayer.net/#{key}"
end

#saveObject



55
56
57
58
59
# File 'lib/fog/softlayer/models/storage/directory.rb', line 55

def save
  requires :key
  service.put_container(key, public)
  true
end