text: 
  module.exports = Goodreads;
  
  require('dotenv').load();
  var request = require('request'),
    parseString = require('xml2js').parseString;
    _ = require('lodash');
  
  /**
   * Goodreads Constructor Function
   * Wrapper for Goodreads API: https://www.goodreads.com/api
   */
  
  function Goodreads() {
  
    this.ApiRoot = 'https://www.goodreads.com/';
  }
  
  /**
   * Search books by Title, Author and ISBN - Returns an array books
   * @param {string} term
   * @param callback
   */
  Goodreads.prototype.searchBooks = function (term, callback) {
    request.get({
      'url': this.ApiRoot + 'search/index.xml',
      'qs': {
        'q': term,
        'key': process.env.KEY
      }
    }, function(err, response, body) {
      if(!_.isUndefined(body) && !err) {
        parseString(body, function(err, result) {
          result = result.GoodreadsResponse.search[0].results[0];
          if(_.has(result, 'work')) {
            var books = [];
            result.work.forEach(function (work) {
              books.push({
                'id': work.best_book[0].id[0]._,
                'title': work.best_book[0].title[0],
                'author': work.best_book[0].author[0].name[0],
                'author_id': work.best_book[0].author[0].id[0]._,
                'publication_year': work.original_publication_year[0]._,
                'image_url': work.best_book[0].image_url[0],
                'rating': work.average_rating[0]._ || work.average_rating[0]
              });
            });
            callback(null, books);
          } else {
            callback(err, null);
          }
        });
      } else {
        callback(err, null);
      }
    }.bind(this));
  };
  
  /**
   * Search books by Title, Author and ISBN - Returns a single book
   * @param {string} term
   * @param callback
   */
  Goodreads.prototype.searchBook = function (term, callback) {
    this.searchBooks(term, function (err, data) {
      if (err || !data) {
        callback(err, null);
      }
      callback(null, _.first(data));
    });
  };
  
  /**
   * Get Author's Info
   * @param {string} term - Name of Author
   * @param callback
   */
  Goodreads.prototype.authorInfo = function (term, callback) {
    var that = this;
    this.searchBook(term, function (err, data) {
      if (err || !data) {
        callback(err, null);
      }
  
      request.get({
        'url': that.ApiRoot + 'author/show.xml',
        'qs': {
          'id': data.author_id,
          'key': process.env.KEY
        }
      }, function(err, response, body) {
        if(!_.isUndefined(body) && !err) {
          parseString(body, function(err, result) {
            result = result.GoodreadsResponse.author[0];
            callback(null, {
              'id': result.id[0],
              'name': result.name[0],
              'link': result.link[0],
              'image_url': result.large_image_url[0],
              'about': result.about[0],
              'works_count': result.works_count[0],
              'gender': result.gender[0],
              'hometown': result.hometown[0],
              'born_at': result.born_at[0],
              'died_at': result.died_at[0]
            });
          });
        } else {
          callback(err, null);
        }
      }.bind(this));
    });
  };
  