common/corpus-common-addon/app/services/geonames-resolver.js
changeset 304 20071981ba2a
child 305 ff6cf3fc5f40
equal deleted inserted replaced
303:2fef8007c2b2 304:20071981ba2a
       
     1 import * as constants from 'corpus-common-addon/utils/constants';
       
     2 
       
     3 import ResolverService from 'corpus-common-addon/services/resolver-service';
       
     4 
       
     5 export default ResolverService.extend({
       
     6 
       
     7   storeKeyBase: 'geonames',
       
     8   apiPath: '/api/v1/geonames/',
       
     9   resDocRoot: 'geonamesids',
       
    10 
       
    11   init() {
       
    12     this._super(...arguments);
       
    13   },
       
    14 
       
    15   processId: function(id) {
       
    16     var geonamesId = id;
       
    17     var m = id.match(constants.GEONAMES_BASE_URLS);
       
    18     if (m) {
       
    19       geonamesId = id.slice(m[0].length);
       
    20     }
       
    21     return geonamesId.replace(/\/+$/, '');
       
    22   },
       
    23 
       
    24   getReturnDictKey: function(id) { return id; },
       
    25 
       
    26   getLabel: function(id) { return this.getName(id); }
       
    27 
       
    28 });