2010-05-24 13:29:01 -04:00
|
|
|
module Bluebox
|
|
|
|
class << self
|
2010-05-24 14:03:52 -04:00
|
|
|
|
2010-05-24 13:29:01 -04:00
|
|
|
if Fog.credentials[:bluebox_api_key]
|
|
|
|
|
|
|
|
def initialized?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def [](service)
|
|
|
|
@@connections ||= Hash.new do |hash, key|
|
|
|
|
hash[key] = case key
|
2010-05-24 14:03:52 -04:00
|
|
|
when :blocks
|
2010-09-07 19:26:01 -04:00
|
|
|
Fog::Bluebox::Blocks.new
|
2010-05-24 13:29:01 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
@@connections[service]
|
|
|
|
end
|
|
|
|
|
2010-09-03 18:32:30 -04:00
|
|
|
def services
|
|
|
|
[:blocks]
|
|
|
|
end
|
|
|
|
|
2010-09-07 19:26:01 -04:00
|
|
|
for collection in Fog::Bluebox::Blocks.collections
|
2010-09-02 19:01:19 -04:00
|
|
|
module_eval <<-EOS, __FILE__, __LINE__
|
|
|
|
def #{collection}
|
|
|
|
self[:blocks].#{collection}
|
|
|
|
end
|
|
|
|
EOS
|
2010-05-24 13:29:01 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
def initialized?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|