110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
|
# File 'lib/fog/openstack/storage/models/file.rb', line 110
def save(options = {})
requires :directory, :key
options['Cache-Control'] = cache_control if cache_control
options['Content-Type'] = content_type if content_type
options['Content-Disposition'] = content_disposition if content_disposition
options['Access-Control-Allow-Origin'] = access_control_allow_origin if access_control_allow_origin
options['Origin'] = origin if origin
options['X-Delete-At'] = delete_at if delete_at
options['X-Delete-After'] = delete_after if delete_after
options['Content-Encoding'] = content_encoding if content_encoding
options.merge!()
if not @dirty
data = service.post_object(directory.key, key, options)
else
requires :body
data = service.put_object(directory.key, key, body, options)
self.content_length = Fog::Storage.get_body_size(body)
self.content_type ||= Fog::Storage.get_content_type(body)
end
update_attributes_from(data)
refresh_metadata
true
end
|