'use strict'

var trello = require("node-trello");
var q = require('q');


// auth
var key = process.env.HUBOT_TRELLO_KEY;
var token = process.env.HUBOT_TRELLO_TOKEN;


var t = new trello(key, token);


module.exports ={ 

    /*******************************************************************/
    /*                              BOARDS                             */
    /*******************************************************************/

	getBoard: function(id, pars, callback){
        var deferred = q.defer();
        t.get("/1/board/"+id, pars, function(err, data){
			if (err) {
      		    deferred.reject(err);
	        };
            deferred.resolve(data);
	    });
        deferred.promise.nodeify(callback);
	    return deferred.promise;
	},

    /*******************************************************************/
    /*                              MEMBERS                            */
    /*******************************************************************/
	getMembers: function(id, pars, callback){
        var deferred = q.defer();
	    t.get("/1/members/"+id, function(err, data) {
	        if (err) {
      		    deferred.reject(err);
	        };
            deferred.resolve(data);
	    });
        deferred.promise.nodeify(callback);
	    return deferred.promise;
	},

    /*******************************************************************/
    /*                              LISTS                              */
    /*******************************************************************/
	getList: function(id, pars, callback){
		var deferred = q.defer();
		t.get("1/lists/"+id, pars, function(err, data){
			if (err){
				deferred.reject(err);
			};
			deferred.resolve(data);
		});
		deferred.promise.nodeify(callback);
		return deferred.promise;
	},



    /*******************************************************************/
    /*                         TESTING PURPOSES                        */
    /*******************************************************************/
	test: function(k){
		var k;
		t.get("1/board/BE7seI7e",'', function(err, data){
			if (err){
				k = err;
			};
			console.log(`cb: ${data}`);
			k = data;
			return k;
		})
		console.log(`k - test: ${k}`);
	}


}




@@ -2034,24 +2034,28 @@
 %0A%09%09var k;%0A%09%09
+k = 
 t.get(%221/boa
@@ -2186,16 +2186,28 @@
 k;%0A%09%09%7D)%0A
+%09%09return k;%0A
 %09%09consol

update trello-integration