2012-05-15 14:54:20 -04:00
|
|
|
require 'fog/ninefold'
|
2011-08-31 16:52:53 -04:00
|
|
|
require 'fog/storage'
|
2012-09-09 00:07:32 -04:00
|
|
|
require 'fog/atmos'
|
2011-06-27 03:55:01 -04:00
|
|
|
|
|
|
|
module Fog
|
|
|
|
module Storage
|
2012-09-09 00:07:32 -04:00
|
|
|
class Ninefold < Fog::Storage::Atmos
|
2011-06-27 03:55:01 -04:00
|
|
|
STORAGE_HOST = "onlinestorage.ninefold.com" #"api.ninefold.com"
|
|
|
|
STORAGE_PATH = "" #"/storage/v1.0"
|
|
|
|
STORAGE_PORT = "80" # "443"
|
|
|
|
STORAGE_SCHEME = "http" # "https"
|
|
|
|
|
|
|
|
requires :ninefold_storage_token, :ninefold_storage_secret
|
2012-09-09 00:07:32 -04:00
|
|
|
recognizes :persistent
|
2011-06-27 03:55:01 -04:00
|
|
|
|
2012-09-09 00:07:32 -04:00
|
|
|
model_path 'fog/atmos/models/storage'
|
2011-06-28 02:05:18 -04:00
|
|
|
model :directory
|
|
|
|
collection :directories
|
2011-07-10 09:44:35 -04:00
|
|
|
model :file
|
|
|
|
collection :files
|
2011-06-27 03:55:01 -04:00
|
|
|
|
|
|
|
module Utils
|
|
|
|
end
|
|
|
|
|
2012-09-09 00:07:32 -04:00
|
|
|
class Mock < Fog::Storage::Atmos::Mock
|
2011-06-27 03:55:01 -04:00
|
|
|
include Utils
|
|
|
|
|
|
|
|
def initialize(options={})
|
|
|
|
@ninefold_storage_token = options[:ninefold_storage_token]
|
|
|
|
@ninefold_storage_secret = options[:ninefold_storage_secret]
|
|
|
|
end
|
|
|
|
|
|
|
|
def request(options)
|
|
|
|
raise "Ninefold Storage mocks not implemented"
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
2012-09-09 00:07:32 -04:00
|
|
|
class Real < Fog::Storage::Atmos::Real
|
2011-06-27 03:55:01 -04:00
|
|
|
include Utils
|
|
|
|
|
|
|
|
def initialize(options={})
|
2012-09-09 00:07:32 -04:00
|
|
|
endpoint = "#{STORAGE_SCHEME}://"\
|
|
|
|
"#{STORAGE_HOST}:"\
|
|
|
|
"#{STORAGE_PORT}"\
|
|
|
|
"#{STORAGE_PATH}"
|
|
|
|
options[:atmos_storage_endpoint] = endpoint
|
|
|
|
options[:atmos_storage_token] = options[:ninefold_storage_token]
|
|
|
|
options[:atmos_storage_secret] = options[:ninefold_storage_secret]
|
|
|
|
super(options)
|
2011-06-27 03:55:01 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|