common/corpus-common-addon/app/services/geonames-resolver.js
author Chloe Laisne <chloe.laisne@gmail.com>
Thu, 20 Oct 2016 12:54:07 +0530
changeset 373 e952c8a31a2b
parent 305 ff6cf3fc5f40
child 392 4fbe94af93e8
permissions -rw-r--r--
Transcript design + Fix video display and filter component font

import * as constants from 'corpus-common-addon/utils/constants';

import ResolverService from 'corpus-common-addon/services/resolver-service';

export default ResolverService.extend({

  storeKeyBase: 'geonames',
  apiPath: '/api/v1/resolvers/geonames/',
  resDocRoot: 'geonamesids',

  init() {
    this._super(...arguments);
  },

  processId: function(id) {
    var geonamesId = id;
    var m = id.match(constants.GEONAMES_BASE_URLS);
    if (m) {
      geonamesId = id.slice(m[0].length);
    }
    return geonamesId.replace(/\/+$/, '');
  },

  getReturnDictKey: function(id) { return id; },

  getLabel: function(id) { return this.getName(id); }

});