text: 'use strict';
  
  const request = require("request");
  
  const URL = "http://cep.traksatsistemas.com.br";
  
  /**
   *
   * @param cep
   * @returns {Promise}
   */
  exports.byJson = (cep) => {
  
      return new Promise((ok, fail) => {
  
          request.get({url: URL + "/cep/"+ cep}, (error, response, body) => {
              if (error){
                  return fail(error);
              }
              let json = JSON.parse(body);
              ok(json);
          });
  
      });
  
  };
  
  /**
   *
   * @param cep
   * @returns {Promise}
   */
  exports.byXml = (cep) => {
  
      return new Promise((ok, fail) => {
  
          request.get({
              url: URL + "/cep.xml/"+ cep
          }, (error, response, body)=>{
              if (error){
                  return fail(error);
              }
              ok(body);
          });
  
      });
  
  };