mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
f2bd2404d1
This reverts commits:66638b25d7
,3f0314dbd1
, and18ce4b7eca
. Since google-api-client was added as a dependency inafa9b025e9
, multi_json is a de facto dependency of fog, so this is a needless layer. If #1034 is still an issue, I'd be happy to ship a version of multi_json that requires rubygems >= 1.3.5.
66 lines
1.7 KiB
Ruby
66 lines
1.7 KiB
Ruby
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'riakcs'))
|
|
require 'time'
|
|
|
|
module Fog
|
|
module RiakCS
|
|
class Usage < Fog::Service
|
|
|
|
requires :riakcs_access_key_id, :riakcs_secret_access_key
|
|
recognizes :host, :path, :port, :scheme, :persistent
|
|
|
|
request_path 'fog/riakcs/requests/usage'
|
|
request :get_usage
|
|
|
|
class Mock
|
|
include Utils
|
|
|
|
def self.data
|
|
@data ||= Hash.new do |hash, key|
|
|
hash[key] = {}
|
|
end
|
|
end
|
|
|
|
def self.reset
|
|
@data = nil
|
|
end
|
|
|
|
def initialize(options = {})
|
|
configure_uri_options(options)
|
|
end
|
|
|
|
def data
|
|
self.class.data[riakcs_uri]
|
|
end
|
|
|
|
def reset_data
|
|
self.class.data.delete(riakcs_uri)
|
|
end
|
|
end
|
|
|
|
class Real
|
|
include Utils
|
|
|
|
def initialize(options = {})
|
|
require 'mime/types'
|
|
require 'multi_json'
|
|
|
|
configure_uri_options(options)
|
|
@riakcs_access_key_id = options[:riakcs_access_key_id]
|
|
@riakcs_secret_access_key = options[:riakcs_secret_access_key]
|
|
@connection_options = options[:connection_options] || {}
|
|
@persistent = options[:persistent] || false
|
|
|
|
@connection = Fog::Storage.new(
|
|
:provider => 'AWS',
|
|
:aws_access_key_id => @riakcs_access_key_id,
|
|
:aws_secret_access_key => @riakcs_secret_access_key,
|
|
:host => @host,
|
|
:port => @port,
|
|
:scheme => @scheme
|
|
)
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|