
/**
 * Module dependencies.
 */

var request = require('./util/request');
var debug = require('debug')('wpcom:follow');

/**
 * Follow 
 *
 * @param {String} site_id - site id
 * @param {WPCOM} wpcom
 * @api public
 */

function Follow(site_id, wpcom) {
  if (!site_id) {
    throw new Error('`site id` is not correctly defined');
  }

  if (!(this instanceof Follow)) {
    return new Follow(site_id, wpcom);
  }

  this.wpcom = wpcom;
  this._sid = site_id;
}

/**
 * Follow the site
 *
 * @param {Object} [query]
 * @param {Function} fn
 */

Follow.prototype.follow =
Follow.prototype.add = function (query, fn) {
  var path = '/sites/' + this._sid + '/follows/new';
  return this.wpcom.req.put(path, query, null, fn);
};

/**
 * Unfollow the site
 *
 * @param {Object} [query]
 * @param {Function} fn
 */

Follow.prototype.unfollow =
Follow.prototype.del = function (query, fn) {
  var path = '/sites/' + this._sid + '/follows/mine/delete';
  return this.wpcom.req.del(path, query, null, fn);
};

/**
 * Get the follow status for current 
 * user on current blog sites
 *
 * @param {Object} [query]
 * @param {Function} fn
 */

Follow.prototype.state =
Follow.prototype.mine = function (query, fn) {
  var path = '/sites/' + this._sid + '/follows/mine';
  return this.wpcom.req.get(path, query, fn);
};

/**
 * Expose `Follow` module
 */

module.exports = Follow;
@@ -457,16 +457,323 @@
 _id;%0A%7D%0A%0A
+/**%0A * Get the follow status for current %0A * user on current blog sites%0A *%0A * @param %7BObject%7D %5Bquery%5D%0A * @param %7BFunction%7D fn%0A */%0A%0AFollow.prototype.state =%0AFollow.prototype.mine = function (query, fn) %7B%0A  var path = '/sites/' + this._sid + '/follows/mine';%0A  return this.wpcom.req.get(path, query, fn);%0A%7D;%0A%0A
 /**%0A * F
@@ -1306,315 +1306,8 @@
 %7D;%0A%0A
-/**%0A * Get the follow status for current %0A * user on current blog sites%0A *%0A * @param %7BObject%7D %5Bquery%5D%0A * @param %7BFunction%7D fn%0A */%0A%0AFollow.prototype.state =%0AFollow.prototype.mine = function (query, fn) %7B%0A  var path = '/sites/' + this._sid + '/follows/mine';%0A  return this.wpcom.req.get(path, query, fn);%0A%7D;%0A%0A
 /**%0A

tidy code