All files ApiTask.js

15.38% Statements 2/13
0% Branches 0/2
0% Functions 0/3
15.38% Lines 2/13
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 241x                                           1x  
var Api = require('./Api')
 
class ApiTask {
  constructor(opts, config, logger) {
    this.opts = opts
    this.logger = logger
    this.api = new Api(config)
    this.method = opts.method
    this.route = opts.route
    this.query = opts.query
  }
  run(cb) {
    this.api.makeRequest(this.method, this.route, this.query, (err, body) => {
      if (err) {
        cb(err);
      } else {
        console.log(JSON.stringify(body, null, 2));
        cb(null, body);
      }
    })
  }
}
module.exports = ApiTask