<commit_before>'use strict';

var Q = require('kew');

/**
* Wrapper Object. Wraps the client inside the character API so it doesn't need to be bind and pollute this.
* @param {Client} Client
*/
function Guilds (Client) {
  this._client = Client;
}

/**
* Fetch achievement information through the API
* @param {integer} path
* @return {request|promise}
*/
Guilds.prototype.get = function (realm, name, fields) {
  var defer = Q.defer();
  var util = this._client.Utilities;

  realm = util.formatting.normalizeRealm(realm);

  fields = fields || {};

  var fieldsParsed

  if (fields) {
    if (fields.length > 0) {
      fieldsParsed = {
        fields: fields.join(',')
      }
    } else {
      fieldsParsed = {
        fields: fields
      }
    }

  } else {
    fieldsParsed = {};
  }

  var url = urlWrapper(this._client, [realm, name], fieldsParsed);
  var request = this._client._get(url);

  request
  .then(function(body) {
    //check status code to make sure the character exists
    if (body.statusCode == 200) {
      defer.resolve(util.response.createObject(body, this.createAchievement));
    } else {
      defer.reject(new Error("err_not_found"));
    }
  })
  .fail(function(error) {
    var err = util.error.createFromResponse(error);
    defer.reject(err);
  });

  return defer;
}

/**
* Generates and formats api url specifically as they relate to the achievements API.
* @param {Array.<string>} path
* @param {Object} query
* @return {string}
*/
var urlWrapper = function (client, path, query) {
  var newPath = ['wow', 'guild'];
  if (!path) path = [];
  if (!query) query = {};

  for (var x in path) {
    newPath.push(path[x]);
  }

  var path = newPath;

  return client.generateApiUrl(path, query);

}

module.exports = Character;<commit_msg>Fixed unattached module exports<commit_after>'use strict';

var Q = require('kew');

/**
* Wrapper Object. Wraps the client inside the character API so it doesn't need to be bind and pollute this.
* @param {Client} Client
*/
function Guilds (Client) {
  this._client = Client;
}

/**
* Fetch achievement information through the API
* @param {integer} path
* @return {request|promise}
*/
Guilds.prototype.get = function (realm, name, fields) {
  var defer = Q.defer();
  var util = this._client.Utilities;

  realm = util.formatting.normalizeRealm(realm);

  fields = fields || {};

  var fieldsParsed

  if (fields) {
    if (fields.length > 0) {
      fieldsParsed = {
        fields: fields.join(',')
      }
    } else {
      fieldsParsed = {
        fields: fields
      }
    }

  } else {
    fieldsParsed = {};
  }

  var url = urlWrapper(this._client, [realm, name], fieldsParsed);
  var request = this._client._get(url);

  request
  .then(function(body) {
    //check status code to make sure the character exists
    if (body.statusCode == 200) {
      defer.resolve(util.response.createObject(body, this.createAchievement));
    } else {
      defer.reject(new Error("err_not_found"));
    }
  })
  .fail(function(error) {
    var err = util.error.createFromResponse(error);
    defer.reject(err);
  });

  return defer;
}

/**
* Generates and formats api url specifically as they relate to the achievements API.
* @param {Array.<string>} path
* @param {Object} query
* @return {string}
*/
var urlWrapper = function (client, path, query) {
  var newPath = ['wow', 'guild'];
  if (!path) path = [];
  if (!query) query = {};

  for (var x in path) {
    newPath.push(path[x]);
  }

  var path = newPath;

  return client.generateApiUrl(path, query);

}

module.exports = Guilds;
{'fraction_non_alphanumeric': 0.14137447405329592, 'fraction_numerical': 0.002244039270687237, 'mean_word_length': 3.146511627906977, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3346299', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1148, 'n_words': 322}