var User = Class.create({

    initialize: function() {
        var id = jsonRpcWrapper.fetch({
            method: 'user.json',
            params: [],
            onSuccess: this._process_rpc_data.bind(this),
            onError: function () {}
        });
        return id;
    },
    _process_rpc_data: function (jsonRpcResponse) {
        var data = jsonRpcResponse.getValue();
        this._load_data( data );
    },
    _load_data: function(data) {
        if (data != null && data[this.userinfo_rpc_key] != null) {
            Object.extend( this, data[this.userinfo_rpc_key] );
        } else {
            Object.extend( this, data );
        }
        document.fire("user:loaded");
    },

    
    isSignedIn: function() {
        return ( this.signed_in ? true : false );
    }	
});
