lib/hackerearth/HackerEarthAPI.js
function HackerEarthAPI (clientSecretKey, options) {
  if (typeof clientSecretKey != 'string') {
    clientSecretKey = null;
    options = clientSecretKey;
  }
  if (!options) {
    options = {};
  }

  if (!clientSecretKey) {
    throw new Error('You have to provide a client secret key for this to work. If you do not have one, please register your client at https://www.hackerearth.com/api/register.');
  }

  if (!options.version || options.version == '3') {
    this.version = 'v3';
  } else if (options.version == '2') {
    this.version = 'v2';
  } else {
    throw new Error('Version ' + options.version + ' of the HackerEarth API is currently not supported.');
  }

  this.clientSecretKey = clientSecretKey;
  this.httpHost        = 'api.hackerearth.com:443'
  this.httpUri         = 'https://' + this.httpHost;
  this.possibleLangs   = ['C', 'CPP', 'CPP11', 'CLOJURE', 'CSHARP', 'JAVA', 'JAVASCRIPT', 'HASKELL', 'PERL', 'PHP', 'PYTHON', 'RUBY'];
}
function HackerEarthAPI (clientSecretKey, options) {
  if (typeof clientSecretKey != 'string') {
    clientSecretKey = null;
    options = clientSecretKey;
  }
  if (!options) {
    options = {};
  }

  if (!clientSecretKey) {
    throw new Error('You have to provide a client secret key for this to work. If you do not have one, please register your client at https://www.hackerearth.com/api/register.');
  }

  if (!options.version || options.version == '3') {
    this.version = 'v3';
  } else if (options.version == '2') {
    this.version = 'v2';
  } else {
    throw new Error('Version ' + options.version + ' of the HackerEarth API is currently not supported.');
  }

  this.clientSecretKey = clientSecretKey;
  this.httpHost        = 'api.hackerearth.com:443'
  this.httpUri         = 'https://' + this.httpHost;
  this.possibleLangs   = ['C', 'CPP', 'CPP11', 'CLOJURE', 'CSHARP', 'JAVA', 'JAVASCRIPT', 'HASKELL', 'PERL', 'PHP', 'PYTHON', 'RUBY'];
}
function HackerEarthAPI ( clientSecretKey , options ) { if ( typeof clientSecretKey != 'string' ) { clientSecretKey = null ; options = clientSecretKey ; } if ( ! options ) { options = { } ; } if ( ! clientSecretKey ) { throw new Error ( 'You have to provide a client secret key for this to work. If you do not have one, please register your client at https://www.hackerearth.com/api/register.' ) ; } if ( ! options . version || options . version == '3' ) { this . version = 'v3' ; } else if ( options . version == '2' ) { this . version = 'v2' ; } else { throw new Error ( 'Version ' + options . version + ' of the HackerEarth API is currently not supported.' ) ; } this . clientSecretKey = clientSecretKey ; this . httpHost = 'api.hackerearth.com:443' this . httpUri = 'https://' + this . httpHost ; this . possibleLangs = [ 'C' , 'CPP' , 'CPP11' , 'CLOJURE' , 'CSHARP' , 'JAVA' , 'JAVASCRIPT' , 'HASKELL' , 'PERL' , 'PHP' , 'PYTHON' , 'RUBY' ] ; }
Returns a HackerEarth API wrapper object of the specified version. Currently,
only version 3 is supported by this wrapper as HackerEarth has already discontinued
version 2.

Available options are:
- version  The API version to use (2, 3). Defaults to 3.

@param clientSecretKey The client secret key to access the HackerEarth API
@param options Configuration options as described above
@return Instance of the HackerEarth API in the specified version
Returns a HackerEarth API wrapper object of the specified version . Currently only version 3 is supported by this wrapper as HackerEarth has already discontinued version 2 .