Class: Fog::AWS::S3::Directory

Inherits:
Model
  • Object
show all
Extended by:
Deprecation
Defined in:
lib/fog/aws/models/s3/directory.rb

Instance Attribute Summary

Attributes inherited from Model

#connection

Instance Method Summary collapse

Methods included from Deprecation

deprecate

Methods inherited from Model

#collection, #initialize, #inspect, #reload, #to_json, #wait_for

Methods included from Fog::Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Fog::Attributes::InstanceMethods

#_dump, #attributes, #identity, #identity=, #merge_attributes, #new_record?, #requires

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject



17
18
19
20
21
22
23
# File 'lib/fog/aws/models/s3/directory.rb', line 17

def destroy
  requires :key
  connection.delete_bucket(key)
  true
rescue Excon::Errors::NotFound
  false
end

#filesObject



35
36
37
38
39
40
41
42
# File 'lib/fog/aws/models/s3/directory.rb', line 35

def files
  @files ||= begin
    Fog::AWS::S3::Files.new(
      :directory    => self,
      :connection   => connection
    )
  end
end

#locationObject



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

def location
  requires :key
  data = connection.get_bucket_location(key)
  data.body['LocationConstraint']
end

#location=(new_location) ⇒ Object



31
32
33
# File 'lib/fog/aws/models/s3/directory.rb', line 31

def location=(new_location)
  @location = new_location
end

#payerObject



44
45
46
47
48
# File 'lib/fog/aws/models/s3/directory.rb', line 44

def payer
  requires :key
  data = connection.get_request_payment(key)
  data.body['Payer']
end

#payer=(new_payer) ⇒ Object



50
51
52
53
54
# File 'lib/fog/aws/models/s3/directory.rb', line 50

def payer=(new_payer)
  requires :key
  connection.put_request_payment(key, new_payer)
  @payer = new_payer
end

#saveObject



56
57
58
59
60
61
62
63
64
# File 'lib/fog/aws/models/s3/directory.rb', line 56

def save
  requires :key
  options = {}
  if @location
    options['LocationConstraint'] = @location
  end
  connection.put_bucket(key, options)
  true
end