Sha256: 661bcec9960247cd03dbf04eefa8f62efcbd5d2a1b394b0cad170deb1621ac25

Contents?: true

Size: 567 Bytes

Versions: 6

Compression:

Stored size: 567 Bytes

Contents

/* Copyright 2016 The Cocktail Experience, S.L. */

module.exports = {
  call: function(request, conf, callback) {
    var url = conf.refreshing_matter.url;
    request(url, function (error, response, body) {
      if (!error && response.statusCode == 200) {
        var important_matters = JSON.parse(body)[ conf.refreshing_matter.key ],
            random_index = Math.floor(Math.random() * important_matters.length);
        callback(null, important_matters[ random_index ]);
      }
      else {
        callback(error, response.statusCode);
      }
    })
  }
}

Version data entries

6 entries across 3 versions & 1 rubygems

Version Path
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/refreshing_matter.js
tck-lambdas-0.3.0 lib/tck/lambdas/chistacojs/source/refreshing_matter.js
tck-lambdas-0.2.0 lib/tck/lambdas/chistacojs/refreshing_matter.js
tck-lambdas-0.2.0 lib/tck/lambdas/chistacojs/source/refreshing_matter.js
tck-lambdas-0.1.6 lib/tck/lambdas/chistacojs/refreshing_matter.js
tck-lambdas-0.1.6 lib/tck/lambdas/chistacojs/source/refreshing_matter.js