# File lib/rhc/rest/api.rb, line 6
      def initialize(client, preferred_api_versions=[])
        super(nil, client)

        # API version negotiation
        @server_api_versions = []
        debug "Client supports API versions #{preferred_api_versions.join(', ')}"
        @client_api_versions = preferred_api_versions
        @server_api_versions, links = api_info({
          :url => client.url,
          :method => :get,
          :lazy_auth => true,
        })
        debug "Server supports API versions #{@server_api_versions.join(', ')}"

        if api_version_negotiated
          unless server_api_version_current?
            debug "Client API version #{api_version_negotiated} is not current. Refetching API"
            # need to re-fetch API
            @server_api_versions, links = api_info({
              :url => client.url,
              :method => :get,
              :accept => :json,
              :api_version => api_version_negotiated,
              :lazy_auth => true,
            })
          end
        else
          warn_about_api_versions
        end

        attributes['links'] = links

      rescue RHC::Rest::ResourceNotFoundException => e
        raise ApiEndpointNotFound.new(
          "The OpenShift server is not responding correctly.  Check "\
          "that '#{client.url}' is the correct URL for your server. "\
          "The server may be offline or misconfigured.")
      end