<commit_before>'use strict';

const Bluebird = require('bluebird');

const dbg = require('debug')('anamorph:linkedinDataFetcher');

module.exports = class LinkedinDataFetcher {
    constructor(api, user) {
        dbg('Initializing new LinkedinDataFetcher');

        this.user = user;
        this.api = api.init(this.user.access_token);
    }

    fetch() {
        dbg('Fetching linkedin data');

        return this.fetchUserInformation()
            .catch(err => dbg(err));
    }

    //Get the user information
    fetchUserInformation() {
        dbg('Fetching user');

        return new Bluebird((resolve, reject) => {
                this.api.people.me((err, data) => {
                    if (err) {
                        dbg('error: ', err);
                        reject(err);
                    } else {
                        dbg(data);
                        resolve(data);
                    }
                }
            );
        });
    }
};<commit_msg>[LinkedIn] - Added email and number of connections<commit_after>'use strict';

const Bluebird = require('bluebird');

const dbg = require('debug')('anamorph:linkedinDataFetcher');

module.exports = class LinkedinDataFetcher {
    constructor(api, user) {
        dbg('Initializing new LinkedinDataFetcher');

        this.user = user;
        this.api = api.init(this.user.access_token);

        this.data = {
            connections: '',
        };
    }

    fetch() {
        dbg('Fetching linkedin data');

        return this.fetchUserInformation()
            .catch(err => dbg(err));
    }

    //Get the user information
    fetchUserInformation() {
        dbg('Fetching user');

        return new Bluebird((resolve, reject) => {
                this.api.people.me((err, data) => {
                    if (err) {
                        dbg('error: ', err);
                        reject(err);
                    } else {
                        dbg(data);
                        this.data.email = data.emailAddress;
                        this.data.connections = data.numConnections;
                        dbg(`Email: ${this.data.email}`);
                        dbg(`Number of connections: ${this.data.connections}`);
                        resolve(data);
                    }
                }
            );
        });
    }
};
{'fraction_non_alphanumeric': 0.12585616438356165, 'fraction_numerical': 0.0, 'mean_word_length': 1.4318418314255983, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3810675', 'n_tokens_mistral': 637, 'n_tokens_neox': 599, 'n_words': 116}