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

rufbit

v1.0.2

Published

Rufbit is a service that helps you to stay on top of what is going on in all of your projects at all times.

Downloads

5

Readme

rufbit nodejs

Getting Started

Rufbit helps you to stay on top of what is going on in all of your projects at all times. This documentation will help you integrate rufbit into your projects and get you started as fast as possible.

Overview

This package provides user-friendly access to the rufbit API from nodejs applications. It includes pre-defined classes and methods that dynamically communicate with the rufbit API and thereby allow a simple integration.

Installation

If you don't have an account yet, make sure to sign up first.

To install the rufbit package simply run:

npm install rufbit

Alternatively you can also use our API if you prefer that or if your platform is not supported yet.

More information

Usage

First of all you need to require the rufbit package. This can be achieved by adding the following line:

const { Rufbit, RufbitState } = require('./node_modules/rufbit');

In order to use the package, you will first need to set the API-key. This key is specific to your project and can be found in your project configuration (Projects -> [Project] -> Configuration).

The API-key can be set with the following code:

Rufbit.setApiKey("YOUR API-KEY HERE");

More Information

Sending notifications

In order to send notifications, simply call the Rufbit.send(..) function and pass the parameters title, data, state and callback.

Rufbit.send(title, data, state, callback);

|Param|Type|Details| |-----|----|-------| |title|string|The title of your notification| |data|object|A json object that contains your data| |state|integer|Indicates the notification type. For further details see notification object| |callback|function|Callback function, returns the result

Example 1: Send Notification

Rufbit.send("Foobar just subscribed!", { plan: "premium" }, RufbitState.SUCCESS, function(result)
{
    // handle result here
});

The state of the notification can take the values success, error, warning, info and other.

Make sure you are passing a valid JSON object to the data -attribute. A possible JSON-object might look like this:

{
    "email": "[email protected]",
    "username": "foobar",
    "subscription": "premium",
    "paid": true
}

Error Handling:

Rufbit will respond with a result object. If the request completed sucessfully the response will look like this:

{ 
    "success": true 
}

In case a request could not be completed successfully for some reason, rufbit will respond with:

{
    "success": false,
    "error_msg": "error message"
}

This can happen due to many reasons such as a wrong API-key or invalid parameters.

More information

Full Example

const { Rufbit, RufbitState } = require('./node_modules/rufbit');

Rufbit.setApiKey("YOUR API-KEY HERE");
Rufbit.send("title", { data: "example" }, RufbitState.SUCCESS, function(result)
{
    if(result["success"] == true)
    {
        console.log("Successful");
    }
    else
    {
        console.log("Error: " + result["error_msg"])
    }
});