lib/fog/aws/models/storage/file.rb in fog-0.3.13 vs lib/fog/aws/models/storage/file.rb in fog-0.3.14
- old
+ new
@@ -37,21 +37,13 @@
@directory
end
def copy(target_directory_key, target_file_key)
requires :directory, :key
- data = connection.copy_object(directory.key, @key, target_directory_key, target_file_key).body
+ connection.copy_object(directory.key, @key, target_directory_key, target_file_key)
target_directory = connection.directories.new(:key => target_directory_key)
- target_file = target_directory.files.new(attributes.merge!(:key => target_file_key))
- copy_data = {}
- for key, value in data
- if ['ETag', 'LastModified'].include?(key)
- copy_data[key] = value
- end
- end
- target_file.merge_attributes(copy_data)
- target_file
+ target_directory.files.get(target_file_key)
end
def destroy
requires :directory, :key
connection.delete_object(directory.key, @key)
@@ -68,11 +60,17 @@
end
end
def save(options = {})
requires :body, :directory, :key
+ if options != {}
+ Formatador.display_line("[yellow][WARN] options param is deprecated, use acl= instead[/] [light_black](#{caller.first})[/]")
+ end
if @acl
- options['x-amz-acl'] = @acl
+ options['x-amz-acl'] ||= @acl
+ end
+ if content_type
+ options['Content-Type'] = content_type
end
data = connection.put_object(directory.key, @key, @body, options)
@etag = data.headers['ETag']
true
end