lib/fog/aws/models/storage/file.rb in fog-0.3.0 vs lib/fog/aws/models/storage/file.rb in fog-0.3.1

- old
+ new

@@ -15,10 +15,18 @@ attribute :last_modified, :aliases => ['Last-Modified', 'LastModified'] attribute :owner, :aliases => 'Owner' attribute :size, :aliases => 'Size' attribute :storage_class, :aliases => 'StorageClass' + def acl=(new_acl) + valid_acls = ['private', 'public-read', 'public-read-write', 'authenticated-read'] + unless valid_acls.include?(new_acl) + raise ArgumentError.new("acl must be one of [#{valid_acls.join(', ')}]") + end + @acl = new_acl + end + def body @body ||= if last_modified && (file = collection.get(identity)) file.body else '' @@ -59,9 +67,12 @@ end end def save(options = {}) requires :body, :directory, :key + if @acl + options['x-amz-acl'] = @acl + end data = connection.put_object(directory.key, @key, @body, options) @etag = data.headers['ETag'] true end