Skip to content

Instantly share code, notes, and snippets.

@bradgignac
Created July 27, 2012 01:41
Show Gist options
  • Select an option

  • Save bradgignac/3185711 to your computer and use it in GitHub Desktop.

Select an option

Save bradgignac/3185711 to your computer and use it in GitHub Desktop.
Fog API Versioning
provider = attributes.delete(:provider).to_s.downcase.to_sym
version = attributes.delete(:version).to_s.downcase.to_sym
case provider
when :rackspace
if version == :v2
require 'fog/rackspace/compute/v2'
Fog::Compute::Rackspace::V2.new(attributes)
else
require 'fog/rackspace/compute'
Fog::Compute::Rackspace.new(attributes)
end
end
connection = Fog::Compute.new({
:provider => 'Rackspace',
:version => :v2
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment