mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
41 lines
755 B
Ruby
41 lines
755 B
Ruby
module Google
|
|
class << self
|
|
|
|
if Fog.credentials[:google_storage_access_key_id] && Fog.credentials[:google_storage_secret_access_key]
|
|
|
|
def initialized?
|
|
true
|
|
end
|
|
|
|
def [](service)
|
|
@@connections ||= Hash.new do |hash, key|
|
|
hash[key] = case key
|
|
when :storage
|
|
Fog::Google::Storage.new
|
|
end
|
|
end
|
|
@@connections[service]
|
|
end
|
|
|
|
def services
|
|
[:storage]
|
|
end
|
|
|
|
for collection in Fog::Google::Storage.collections
|
|
module_eval <<-EOS, __FILE__, __LINE__
|
|
def #{collection}
|
|
self[:storage].#{collection}
|
|
end
|
|
EOS
|
|
end
|
|
|
|
else
|
|
|
|
def initialized?
|
|
false
|
|
end
|
|
|
|
end
|
|
end
|
|
|
|
end
|