mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
a72433d2f8
Following work on reorganising the requires, there was an inconsistent approach to where service wrappers are required. (Fog::Compute...) Since they should be standardised and shared across providers (although they really aren't yet) they have been moved to `fog-core` gem. Each provider has their own `lib/fog/{provider}/core` files that is required by each of their services. These files should all require `fog/core` which already required most or these. So this removes the extra cases to concentrate them in core.
54 lines
1.4 KiB
Ruby
54 lines
1.4 KiB
Ruby
require 'fog/ninefold'
|
|
require 'fog/atmos'
|
|
|
|
module Fog
|
|
module Storage
|
|
class Ninefold < Fog::Storage::Atmos
|
|
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
|
|
recognizes :persistent
|
|
|
|
model_path 'fog/atmos/models/storage'
|
|
model :directory
|
|
collection :directories
|
|
model :file
|
|
collection :files
|
|
|
|
module Utils
|
|
end
|
|
|
|
class Mock < Fog::Storage::Atmos::Mock
|
|
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
|
|
|
|
class Real < Fog::Storage::Atmos::Real
|
|
include Utils
|
|
|
|
def initialize(options={})
|
|
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)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|