Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatling_gun

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatling_gun

  • 0.0.4
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

Gatling Gun

Gatling Gun is a library that helps you blast out a group of emails. It's a simple wrapper over SendGrid's Newsletter API.

Installation

Add this line to your application's Gemfile:

gem "gatling_gun"

Then require the library in your code:

require "gatling_gun"

You will probably want to setup Gatling Gun as your application loads. I recommend just setting a constant you can then refer to throughout your application. In Rails, I would put the following code in config/initializers/gatling_gun.rb. Setup is easy, just add you SendGrid credentials:

SendGrid = GatlingGun.new("USERNAME", "PASSWORD")

Usage

The minimal steps to create and send a newsletter would be something like the following. First, you need an identity to send from:

SendGrid.add_identity( "test", name:    "Test User",
		               email:   "test@subinterest.com",
                               address: "513 Cinnamon Dr.",
                               city:    "Edmond",
                               state:   "OK",
                               zip:     "73003",
                               country: "USA" )

Then you can create a newsletter using that identity:

SendGrid.add_newsletter( "episode1", identity: "test",
                                     subject:  "Episode 1",
                                     text:     "The Text Body",
                                     html:     "<h1>The HTML Body</h1>" )

Next you need to create a list of recipients, add some emails to it, and attach that list to the newsletter:

SendGrid.add_list("subscribers")
SendGrid.add_emails("subscribers", [ { name:  "James Edward Gray II",
                                       email: "james@graysoftinc.com" },
                                     { name:  "Admin",
                                       email: "admin@graysoftinc.com" } ] )
SendGrid.add_recipients("episode1", "subscribers")

Of course, you could reuse identities and recipient lists for future newsletter messages without needing to recreate them.

Finally, you can schedule when to have the message sent:

SendGrid.add_schedule("episode1", at: Time.now + 10 * 60)

That would sent it 10 minutes from now, but you can adjust the time to whenever you desire or even leave it out to send now.

FAQs

Package last updated on 10 Sep 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc