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

guerrilla-api

v0.2.1

Published

Guerrilla-api is a node module that wraps the guerrilla api (I have chosen an amazing and creative name, don't you think so?) to smooth the comunication of your app/module with their service.

Downloads

9

Readme

guerrilla-api

Guerrilla API module for Node

npm install guerrilla-api

why

Well, I first wrote this module to enable automated tests that depend on e-mail. For example, I'm design a software where the user can create an account, and it is expected that this user receive an e-mail to validate his/her account. Since I use Guerrilla Mail a lot and they have a not so bad api, I have decided to write this module to use it in my automated tests.

why not

You might ask why haven't I used another pre-existing module. You would receive a short an easy answer: I haven't find any module with a good documentation and interface.

usage

First things first. Guerrilla Mail api expects you to pass an ip address that is the origin of your requests. Besides that, it also expects you to provide an user agent. So there we go:

var Guerrilla = require('guerrilla-api');
var guerrillaApi = new Guerrilla('127.0.0.1', 'automated-test-agent');

From that, we are now ready to make our first call to Guerrilla api. Let's see what e-mail address they give us.

guerrillaApi.getEmailAddress(function(err, address) {
	if (err) {
		console.log('Holly crap, something went wrong!' + err);
	} else {
		console.log('As I expected. My new temp e-mail is: ' + address);
	}
});

Well, maybe you don't like the e-mail address randomly provided by Guerrilla. So, lets create one of our own.

guerrillaApi.setEmailAddress(desiredUsernameEmail, function (err, address) {
	if (err) {
		console.log('Weirdooo, something went wrong!' + err);
	} else {
		console.log('Nice, I have a new e-mail address. Check it out: '
				+ address);
	}
});

Now that we have a nice e-mail address, let's check what do we have in our inbox:

guerrillaApi.checkEmail(function (err, emails) {
	if (err) {
		console.log('Noooooo, an error? It must be a solar storm. Let\'s see: '
					+ err);
	} else {
		emails.forEach(function(email) {
			console.log(email.mail_from +
				' sent me an e-mail with the following subject: '
				+ mail.mail_subject);
		});
	}
});