(function(context,$) {

    /**
     * Javascript wrappers for the REST API
     */

    "use strict";


    context.JK = context.JK || {};
    context.JK.FacebookRest = function() {

        var self = this;
        var logger = context.JK.logger;

        // https://developers.facebook.com/docs/reference/api/post
        function post(options) {
            var d = $.Deferred();

            FB.api(
                'https://graph.facebook.com/me/feed',
                'post',
                options,
                function(response) {
                    if (!response || response.error) {
                        d.reject(response)
                    } else {
                        d.resolve(response);
                    }
                }
            )

            return d;
        }

        this.post = post;

        return this;
    };
})(window,jQuery);