Sha256: abbd108099f6943c883b831f0035668415e8318a56ac2e92bbf01818ed391144
Contents?: true
Size: 1.94 KB
Versions: 1
Compression:
Stored size: 1.94 KB
Contents
module Fog module Storage class GoogleJSON class Files < Fog::Collection extend Fog::Deprecation deprecate :get_url, :get_https_url attribute :common_prefixes, :aliases => "CommonPrefixes" attribute :delimiter, :aliases => "Delimiter" attribute :directory attribute :page_token, :aliases => %w(pageToken page_token) attribute :max_results, :aliases => ["MaxKeys", "max-keys"] attribute :prefix, :aliases => "Prefix" model Fog::Storage::GoogleJSON::File def all(options = {}) requires :directory load(service.list_objects(directory.key, options)[:body]["items"]) end alias_method :each_file_this_page, :each def each if !block_given? self else subset = dup.all subset.each_file_this_page { |f| yield f } self end end def get(key, options = {}, &block) requires :directory data = service.get_object(directory.key, key, options, &block) file_data = {} data.headers.each do |k, v| file_data[k] = v end file_data.merge!(:body => data.body, :key => key) new(file_data) rescue Fog::Errors::NotFound nil end def get_https_url(key, expires) requires :directory service.get_object_https_url(directory.key, key, expires) end def head(key, options = {}) requires :directory data = service.head_object(directory.key, key, options) file_data = data.headers.merge(:key => key) new(file_data) rescue Fog::Errors::NotFound nil end def new(attributes = {}) requires :directory super({ :directory => directory }.merge(attributes)) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-google-0.5.3 | lib/fog/storage/google_json/models/files.rb |