     @appSecret = appSecret
     @status = Carrot.Status.Unknown
     @hostname = hostname or "gocarrot.com"
+    @scheme = ("http" if hostname?.match(/^localhost/)) or "https"
 
   ajaxGet: (url, callback) ->
     if @request

      url_string = url_string + "#{k}=#{url_params[k]}&"
    url_string = url_string.slice(0, url_string.length - 1);

    sign_string = "POST\n#{@hostname}\n#{endpoint}\n#{url_string}"
    digest = CryptoJS.HmacSHA256(sign_string, @appSecret).toString(CryptoJS.enc.Base64)
    url_params.sig = digest

    @ajaxPost("https://#{@hostname}#{endpoint}", url_params, callback)

  GUID: ->
    S4 = () => return Math.floor(Math.random() * 0x10000).toString(16)

    )

  createUser: (accessToken, callback) ->
    @ajaxPost("#{@scheme}://#{@hostname}/games/#{@appId}/users.json",
      {'access_token': accessToken, 'api_key': @udid},
      (statusCode) =>
        switch statusCode
