Project

trypaper

0.0
No commit activity in last 3 years
No release in over 3 years
Using this gem allows you to upload Base64 encoded documents and send them to the TryPaper API endoints. Manage your mailing from your TryPaper dashboard.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
~> 0
~> 0
 Project Readme

TryPaperAPI


A gem for TryPaper API. Use when you need to print and mail letters via USPS.

Gem requires API keys from TryPaper.com

Installation

Add this line to your application's Gemfile:

gem 'TryPaper'

And then execute:

$ bundle

Or install it yourself as:

$ gem install TryPaper

Usage

Instantiate the client with API and return address ID(both created in the TryPaper dashboard):

return_address_id = "main_street_headquarters"
api_key = "AAABBDDCCDDSS"
client = TryPaper::Mailer.new(api_key, return_address_id)

Add optional printing tags array if desired. See available tags here.

return_address_id = "main_street_headquarters"
api_key = "AAABBDDCCDDSS"
client = TryPaper::Mailer.new(api_key, return_address_id, ["force_bw", "duplicate_contents"])

Set the recipient value(leave address2 blank if needed):

client.recipient.configure do |r|
  r.name = "Patrick Jones"
  r.address1 = "555 Main Street"
  r.address2 = "Apartment #3"
  r.city = "Denver"
  r.state = "CO"
  r.zipcode = "55555"
end

Read PDF document into variable and load into client:

file = File.read('./documents/business_report.pdf')
doc = TryPaper::Document.new(file)
client.document = doc

Submit document to TryPaperAPI

client.submit

Check TryPaper API logs to see printing status (document recieved, printing, printed, mailed, etc).

Contributing

  1. Fork it ( https://github.com/pmichaeljones/TryPaperAPI/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request