Sha256: af94b84ab2fbfef89a325519701de7bf9667d534edaf5bee5ccfc329e506728f

Contents?: true

Size: 945 Bytes

Versions: 7

Compression:

Stored size: 945 Bytes

Contents

class NewServers < Fog::Bin
  class << self

    def class_for(key)
      case key
      when :compute, :new_servers
        Fog::NewServers::Compute
      else 
        raise ArgumentError, "Unsupported #{self} service: #{key}"
      end
    end

    def [](service)
      @@connections ||= Hash.new do |hash, key|
        hash[key] = case key
        when :compute
          Fog::Compute.new(:provider => 'NewServers')
        when :new_servers
          location = caller.first
          warning = "[yellow][WARN] NewServers[:new_servers] is deprecated, use NewServers[:compute] instead[/]"
          warning << " [light_black](" << location << ")[/] "
          Formatador.display_line(warning)
          Fog::Compute.new(:provider => 'NewServers')
        else
          raise ArgumentError, "Unrecognized service: #{service}"
        end
      end
      @@connections[service]
    end

    def services
      [:compute]
    end

  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
fog-0.5.1 lib/fog/bin/new_servers.rb
fog-0.5.0 lib/fog/bin/new_servers.rb
phpfog-fog-0.4.1.3 lib/fog/bin/new_servers.rb
phpfog-fog-0.4.1.2 lib/fog/bin/new_servers.rb
phpfog-fog-0.4.1.1 lib/fog/bin/new_servers.rb
phpfog-fog-0.4.1 lib/fog/bin/new_servers.rb
fog-0.4.1 lib/fog/bin/new_servers.rb