npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

runscope

v0.0.17

Published

Runscope REST API Library

Downloads

98

Readme

node-runscope

A promise-based library for interacting with the Runscope.

Designed to conform to the structure of the Runscope REST API.

Suggested Usage: https://github.com/louishawkins/node-runscope/blob/master/example.js.

See Runscope API documentation for specific parameters: https://www.runscope.com/docs/api

Get Started

  var runscope = require('runscope')(YOUR_RUNSCOPE_TOKEN);

Methods

List Buckets

  runscope.bucketList();

Create Bucket

  runscope.createBucket(opts);

Account Info

  runscope.account();

Available Service Regions

  runscope.regions();

Bucket Methods

  var myBucket = runscope.bucket(YOUR_BUCKET_KEY);

Bucket Details

  myBucket.detail();

List Tests

  myBucket.listTests();

Find Test By Name

  myBucket.findTestByName('My Test').then(function (myTest) {
      // myTest object has access to all methods
      // outlined under "Test Methods" below.
      myTest.trigger();
  }

Messages API (Traffic Inspector) Methods

A Message for the purposes of this API represents an HTTP request and response pair. Each message can contain a request, a response, or both (most common).

    var opts = {
        count: 50, //int
        since: new Date(), //timestamp
        before: new Date(), //timestamp
    }
    // retrieve all messages
    myBucket.messages(opts);
    // retrieve all errors
    myBucket.errors(opts);
    //retrive shared
    myBucket.shared(opts);
    //retrieve captures
    myBucket.captures(opts);

Test Methods

List Tests

  var myBucketTests = myBucket.tests;
  myBucketTests.list();

Create Test

  var opts = {
      name: 'Test Name',
      description: 'This is a description of the test'
  }

  myBucketTests.create(opts).then(function (newTest) {
      // newTest is a new Test object
      
      var requestOpts = {
          method: 'GET',
          url: 'http://www.google.com'
      }
      newTest
          .addRequest(requestOpts)
          .then(newTest.trigger())
          .then(done);
  }).catch(function (error) {
    //error
  }

Get Test Details

  myTest = myBucket.test(TEST_ID);
  myTest.detail();

Trigger Test

  myTest.trigger();
  
  // results are usually available 
  // after 2 seconds
  myTest
    .trigger()
    .delay(2000)
    .then(function () {
        return myTest.results.latest();
    })
    .then(function (results) {
        console.log(results);
    })
    .catch(function (err) {
      throw new Error(err);
    }

Update Test

  myTest.update(opts);

Delete Test

  myTest.delete();

Test Resources

The Tests object contains four resources:

  Tests.environments
  Tests.results
  Tests.schedules
  Tests.steps

Tests.steps

Add Step

  // step type will default to "request"
  myTest.steps.add(opts);
  
  // more expressively
  myTest.steps.addRequest(opts);
  
  //chain as many as you want
  // Note: currently step order is not guaranteed.
  // See: https://github.com/louishawkins/node-runscope/issues/1
  myTest.steps
    .addRequest(STEP_ONE)
    .addRequest(STEP_TWO)
    .add(STEP_n)
    .then(doStuff)
    .catch();
  
  //other step types
  myTest.addPause({ duration: 2 /* seconds */});
  myTest.addCondition(opts);
  myTest.ghostInspector(opts); //yes even a ghost inspector step

Change Step Order

  myTest.steps.changeOrder(opts);

Step Detail

  myTest.steps.detail(STEP_ID);

Update Step

  myTest.steps.update(STEP_ID, opts);

Delete Step

  myTest.steps.delete(STEP_ID);

Tests.schedules

Create Schedule

  myTest.schedules.create(opts);

Modify Schedule

  myTest.schedules.modify(SCHEDULE_ID, opts);

Show Schedule Details

  myTest.schedules.detils(SCHEDULE_ID);

Delete (stop) a Schedule

  myTest.schedules.delete(SCHEDULE_ID);
  //or
  myTest.schedules.stop(SCHEDULE_ID);

Tests.results

Get Latest Test Result

  myTest.results.latest();

List Test Runs

  myTest.results.list();

Show Details for a Test Run

  myTest.results.detail(TEST_RUN_ID);

Tests.environments

  myTest.environments.list();
  myTest.environments.create(opts);
  myTest.environments.modify(opts);
  myTest.environments.detail(ENV_ID);
  myTest.environments.delete(ENV_ID);

References

Bluebird: http://bluebirdjs.com/docs/api-reference.html