Sha256: 1ed8a0d6d04dc96e355fc5e9c4c81d6570a55a2c30a8394bcd6601a12b273f60

Contents?: true

Size: 488 Bytes

Versions: 3

Compression:

Stored size: 488 Bytes

Contents

module Adhoq
  module Storage
    class FogStorage
      def store(suffix = nil, seed = Time.now, &block)
        Adhoq::Storage.with_new_identifier(suffix, seed) do |identifier|
          io = yield
          io.rewind

          directory.files.create(key: identifier, body: io, public: false)
        end
      end

      def get(identifier)
        get_raw(identifier).body
      end

      def get_raw(identifier)
        directory.files.head(identifier)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adhoq-0.0.5 lib/adhoq/storage/fog_storage.rb
adhoq-0.0.4 lib/adhoq/storage/fog_storage.rb
adhoq-0.0.3 lib/adhoq/storage/fog_storage.rb