
/**
 * Module dependencies.
 */

var Action = require('./lib/action');
var Site = require('./lib/site');
var req = require('./lib/req');
var debug = require('debug')('wp-connect');

/**
 * Wordpress connect class
 *
 * @param {Object} opts
 * @api public
 */

function WPCONN(opts){
  this.opts = opts = {};
  this.headers = {};

  // site stuff
  this.site = new Site(this);

  // post methods
  this.post = new Action('post', this);
}

/**
 * Set Access token
 *
 * @param {String} token
 * @api public
 */

WPCONN.prototype.setToken = function(token){
  this.opts.token = token;
};

/**
 * User profile
 *
 * @param {Object} opts (optional)
 * @param {Function} fn
 * @api private
 */

WPCONN.prototype.me = function (opts, fn){
  opts.token = opts.token || this.opts.token;
  req('me', null, opts, fn);
};

/**
 * Get wordpress posts
 *
 * @param {String} rid resource id
 * @param {Object} opts
 * @param {Function} fn
 * @api public
 */

WPCONN.prototype.posts = function (rid, opts, fn){
  opts.token = opts.token || this.opts.token;
  req('posts', { site: rid }, opts, fn);
};

/**
 * Expose `WPCONN` module
 */

module.exports = WPCONN;

@@ -809,283 +809,8 @@
 %7D;%0A%0A
-/**%0A * Get wordpress posts%0A *%0A * @param %7BString%7D rid resource id%0A * @param %7BObject%7D opts%0A * @param %7BFunction%7D fn%0A * @api public%0A */%0A%0AWPCONN.prototype.posts = function (rid, opts, fn)%7B%0A  opts.token = opts.token %7C%7C this.opts.token;%0A  req('posts', %7B site: rid %7D, opts, fn);%0A%7D;%0A%0A
 /**%0A

remove posts method