All files / lib/geocoder pickpointgeocoder.js

100% Statements 13/13
100% Branches 6/6
100% Functions 1/1
100% Lines 13/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 272x 2x         2x 5x   4x 1x     3x 1x     2x     2x   2x 2x   2x  
var util                  = require('util'),
  OpenStreetMapGeocoder   = require('./openstreetmapgeocoder');
 
/**
 * Constructor
 */
var PickPointGeocoder = function PickPointGeocoder(httpAdapter, options) {
  PickPointGeocoder.super_.call(this, httpAdapter, options);
 
  if (!httpAdapter.supportsHttps()) {
    throw new Error('You must use https http adapter');
  }
 
  if (!this.options.apiKey || this.options.apiKey == 'undefined') {
    throw new Error(this.constructor.name + ' needs an apiKey');
  }
 
  this.options.key = this.options.apiKey;
};
 
util.inherits(PickPointGeocoder, OpenStreetMapGeocoder);
 
PickPointGeocoder.prototype._endpoint = 'https://api.pickpoint.io/v1/forward';
PickPointGeocoder.prototype._endpoint_reverse = 'https://api.pickpoint.io/v1/reverse';
 
module.exports = PickPointGeocoder;