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

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

Instance Attribute Summary

Attributes inherited from Model

#connection

Instance Method Summary collapse

Methods inherited from Model

#_dump, _load, aliases, attribute, #attributes, attributes, #collection, identity, #identity, #initialize, #inspect, #merge_attributes, #new_record?, #reload, #requires, #to_json, #wait_for

Constructor Details

This class inherits a constructor from Fog::Model

Instance Method Details

#destroyObject


14
15
16
17
18
19
20
# File 'lib/fog/aws/models/s3/directory.rb', line 14

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

#filesObject


32
33
34
35
36
37
38
39
# File 'lib/fog/aws/models/s3/directory.rb', line 32

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

#locationObject


22
23
24
25
26
# File 'lib/fog/aws/models/s3/directory.rb', line 22

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

#location=(new_location) ⇒ Object


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

def location=(new_location)
  @location = new_location
end

#payerObject


41
42
43
44
45
# File 'lib/fog/aws/models/s3/directory.rb', line 41

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

#payer=(new_payer) ⇒ Object


47
48
49
50
51
# File 'lib/fog/aws/models/s3/directory.rb', line 47

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

#saveObject


53
54
55
56
57
58
59
60
61
# File 'lib/fog/aws/models/s3/directory.rb', line 53

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