Sha256: 48672dc0c8713fe01bcfafe8c194fff62b9e4c4a8e788606cbf796b52b863c19

Contents?: true

Size: 884 Bytes

Versions: 3

Compression:

Stored size: 884 Bytes

Contents

require 'fog/rackspace/files'
require 'fog/rackspace/servers'

module Fog
  module Rackspace

    def self.authenticate(options)
      rackspace_auth_url = options[:rackspace_auth_url] || "auth.api.rackspacecloud.com"
      connection = Fog::Connection.new("https://" + rackspace_auth_url)
      @rackspace_api_key  = options[:rackspace_api_key]
      @rackspace_username = options[:rackspace_username]
      response = connection.request({
        :expects  => 204,
        :headers  => {
          'X-Auth-Key'  => @rackspace_api_key,
          'X-Auth-User' => @rackspace_username
        },
        :host     => rackspace_auth_url,
        :method   => 'GET',
        :path     => 'v1.0'
      })
      response.headers.reject do |key, value|
        !['X-Server-Management-Url', 'X-Storage-Url', 'X-CDN-Management-Url', 'X-Auth-Token'].include?(key)
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-0.2.30 lib/fog/rackspace.rb
fog-0.2.28 lib/fog/rackspace.rb
fog-0.2.27 lib/fog/rackspace.rb