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

newslettre

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

newslettre

  • 0.2.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Newslettre

While writing this Sendgrid Newsletter API client in ruby I noticed several flaws in their API conception. Something like, returning 401 Status code when resources cannot be found are pretty gross but anyway this client should be mostly complete (still work in progress, scheduling etc.).

Installation


gem install newslettre

Usage

this is definitely going to change since it's tedious to pass the client instance around. Maybe there will be a top-level wrapper to give you access to all the modules the API defines (Identity, Newsletter, Recipients)

Right now it works like this…


require 'newslettre'

client = Newslettre::Client.new "somebody@yourdomain.com", "reallygoodpassword"
  
# Accessing newsletters
  
client.newsletters.to_a # => [{ "name" => "webdev" }] 
  
client.newsletters.get("webdev") # => { "name", "subject" => "Latest Web Development News", "html" =>  "<html>...</html>" }

client.newsletters.delete "webdev"

# Accessing recipients of a newsletter

client.newsletters.get("webdev").recipients.to_a # => [{ "list" => "web-developers" }]
  
client.newsletters.get("webdev").recipients.delete "web-developers"
  

nearly the same goes for Identity, Lists, Lists::Email and Letter::Recipients

You can also use #lists and #identities as well as the nested emails in recipient lists.


client.lists.get("web-developers").emails.delete "selective@hosted.com", "programmatic@failure.com"
  

Last but not least, to schedule an already existing newsletter:


client.newsletters.get("webdev").schedule! :at => Time.now

# to see when a newsletter will be delivered

client.newsletters.get("webdev").schedule # => Mon Sep 26 14:01:13 +0200 2011

# and to deschedule again

client.newsletters.get("webdev").deschedule!
    

Development

though it is still far from complete, if you'd like to help out please submit pull request with passing specs (or scenarios)

you will need to add a config/newslettre.yml containing something like this:

sendgrid:
  username: "somebody@yourdomain.com"
  password: "reallysecurepassword"

identity:
  email: "info@yourdomain.com"
  name: "Lennart Melzer"
  address: "Where you live 15"
  city: "Downtown"
  state: "C"
  zip: "12345"
  country: "EF"

letter:
  name: "test"
  identity: "test-identity"
  subject: "A letter to the world!"
  html: "<html><body><h1>A rendered Headline</h1></body></html>"
  text: "An unrendered Headline"

emails:
  -
    email: somebody@yourdomain.com
    name: Some Body
  -
    email: someone@else.com
    name: Someone Else

to make the specs pass

FAQs

Package last updated on 14 Oct 2011

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