Skip to content

Instantly share code, notes, and snippets.

payload = Hash.new
# NOTE: Replace the text MY_API_KEY with the value of your personal API key
payload[:api_key] = MY_API_KEY
payload[:letter] = Hash.new
payload[:letter][:pdf] = File.new("/path/to/file")
payload[:letter][:sender_attributes] = {
:name => "Some Dude",
:street1 => "123 Any Street",
:city => "Ashburn",
:state => "VA",
<data>
<mailing-month>01</mailing-month>
<mailing-day>01</mailing-day>
<letter>
<pdf-remote-url>http://www.irs.gov/pub/irs-pdf/fw4.pdf</pdf-remote-url>
<sender-attributes>
<zip>20148</zip>
<city>Ashburn</city>
<street1>123 Any Street</street1>
<name>Some Dude</name>
# http://rdoc.info/projects/archiloque/rest-client
require 'rest_client'
##########################################
# Get all my letters
# curl -X GET http://localhost:3000/letters.xml?api_key=1b9884c66a
# curl -X GET http://localhost:3000/letters.json?api_key=1b9884c66a
RestClient.get 'http://localhost:3000/letters.xml?api_key=1b9884c66a'
##########################################
https://www.mailfinch.com/:controller/:id(.:format)