Parent

Class/Module Index [+]

Quicksearch

Fog::Storage::Brightbox::File

Public Instance Methods

body() click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 19
def body
  attributes[:body] ||= if last_modified
    collection.get(identity).body
  else
    ''
  end
end
body=(new_body) click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 27
def body=(new_body)
  attributes[:body] = new_body
end
copy(target_directory_key, target_file_key, options={}) click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 35
def copy(target_directory_key, target_file_key, options={})
  requires :directory, :key
  options['Content-Type'] ||= content_type if content_type
  options['Access-Control-Allow-Origin'] ||= access_control_allow_origin if access_control_allow_origin
  options['Origin'] ||= origin if origin
  service.copy_object(directory.key, key, target_directory_key, target_file_key, options)
  target_directory = service.directories.new(:key => target_directory_key)
  target_directory.files.get(target_file_key)
end
destroy() click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 45
def destroy
  requires :directory, :key
  service.delete_object(directory.key, key)
  true
end
directory() click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 31
def directory
  @directory
end
metadata() click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 51
def metadata
  @metadata ||= headers_to_metadata
end
owner=(new_owner) click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 55
def owner=(new_owner)
  if new_owner
    attributes[:owner] = {
      :display_name => new_owner['DisplayName'],
      :id           => new_owner['ID']
    }
  end
end
public=(new_public) click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 64
def public=(new_public)
  new_public
end
public_url() click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 81
def public_url
  requires :key
  self.collection.get_url(self.key)
end
save(options = {}) click to toggle source
# File lib/fog/brightbox/models/storage/file.rb, line 87
def save(options = {})
  requires :body, :directory, :key
  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.merge!(metadata_to_headers)

  data = service.put_object(directory.key, key, body, options)
  update_attributes_from(data)
  refresh_metadata

  self.content_length = Fog::Storage.get_body_size(body)
  self.content_type ||= Fog::Storage.get_content_type(body)
  true
end
url(expires, options = {}) click to toggle source

Get a url for file.

required attributes: key

@param expires [String] number of seconds (since 1970-01-01 00:00) before url expires @param options [Hash] @return [String] url

# File lib/fog/brightbox/models/storage/file.rb, line 76
def url(expires, options = {})
  requires :directory, :key
  self.service.create_temp_url(directory.key, key, expires, "GET", options)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.