Sha256: 23efe4317fea9a99bd2300ee1485b2451e71605dc2077040fd78514ab5c6a0ab
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
class Fog::Storage::Backblaze::Files < Fog::Collection model Fog::Storage::Backblaze::File attribute :directory #attribute :common_prefixes, :aliases => "CommonPrefixes" #attribute :delimiter, :aliases => "Delimiter" #attribute :page_token, :aliases => %w(pageToken page_token) #attribute :max_results, :aliases => ["MaxKeys", "max-keys"] #attribute :prefix, :aliases => "Prefix" model Fog::Storage::Backblaze::File def all(options = {}) requires :directory body = service.list_objects(directory.key, options).body load(body["files"] || []) end def get(file_name) requires :directory file_response = service.get_object(directory.key, file_name) file_data = _headers_to_attrs(file_response) new(file_data) end def new(attributes = {}) requires :directory super({directory: directory}.merge!(attributes)) end # TODO: download url for private buckets def get_https_url(file_name, expires, options) requires :directory service.get_object_https_url(directory.key, file_name, expires, options) end # TODO: download url for private buckets def head_url(file_name, expires, options = {}) requires :directory service.get_object_https_url(directory.key, key, expires, options) end def head(file_name, options = {}) requires :directory data = service.head_object(directory.key, file_name, options) file_data = _headers_to_attrs(file_response) new(file_data) rescue Excon::Errors::NotFound nil end def _headers_to_attrs(file_response) { fileName: file_response.headers['x-bz-file-name'], fileId: file_response.headers['x-bz-file-id'], uploadTimestamp: file_response.headers['X-Bz-Upload-Timestamp'], contentType: file_response.headers['Content-Type'], contentLength: file_response.headers['Content-Length'] } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fog-backblaze-0.2.0 | lib/fog/storage/backblaze/models/files.rb |
fog-backblaze-0.1.2 | lib/fog/storage/backblaze/models/files.rb |
fog-backblaze-0.1.1 | lib/fog/backblaze/models/files.rb |