{"size": 1098, "ext": "js", "max_stars_repo_path": "sites-clear-location.js", "max_stars_repo_name": "xm-craig/xm-site-geocoder", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "sites-clear-location.js", "max_issues_repo_name": "xm-craig/xm-site-geocoder", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "sites-clear-location.js", "max_forks_repo_name": "xm-craig/xm-site-geocoder", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.1538461538, "max_line_length": 108, "alphanum_fraction": 0.543715847}
var googleMaps  = require('@google/maps');
var xmattersApi = require('xm-api-services-js');

const _DEBUG = true;

var googleMapsClient = googleMaps.createClient({
    key: 'AIzaSyBt64hHNgKbFo7_4UifGY_RDmiuZcOTOKM',
    Promise: Promise
});

var xMClient = xmattersApi.createClient({
    host:'craiggulliver.xmatters.com',
    username: 'rest-admin',
    password:'1234',
    debug: _DEBUG
});


xMClient.get('sites', function(err, response) {
    if (!err) {
        for(var i = 0; i < 5; i++) {
            var site = response.data[i];

            if (site.latitude || site.longitude) {
                site.latitude = '';
                site.longitude = '';
                if (_DEBUG) console.log("Clearing location for: " + site.name);
                xMClient.post('sites', site, function(err, response) {
                    if (err) {
                        console.error("ERROR An error occurred while updating site: " + siteData.name, err);
                    }
                });
            }
        }
    } else {
        console.error('xMatters request failed', err);
    }
});
