Sha256: a66c0534a76806b341c6b50f1a639e523b013d0c0d21fe022a64232c71478e3d

Contents?: true

Size: 841 Bytes

Versions: 3

Compression:

Stored size: 841 Bytes

Contents

require 'httparty'
module Smithy
  module Dragonfly
    module DataStorage
      class RemoteDataStore
        include ::Dragonfly::Configurable

        def store(temp_object, opts={})
          # raise "Sorry friend, this datastore is read-only."
        end

        def retrieve(uid)
          response = HTTParty.get uid, :timeout => 3
          unless response.ok?
            #raise Forbidden if response.code == 403
            raise DataNotFound
          end

          content = response.body
          extra_data = {}
          [
            content,            # either a File, String or Tempfile
            extra_data          # Hash with optional keys :meta, :name, :format
          ]
        end

        def destroy(uid)
          raise "Sorry friend, this datastore is read-only."
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smithycms-0.0.3 lib/smithy/dragonfly/remote_data_store.rb
smithycms-0.0.2 lib/smithy/dragonfly/remote_data_store.rb
smithycms-0.0.1 lib/smithy/dragonfly/remote_data_store.rb