Skip to content

Instantly share code, notes, and snippets.

@joncalhoun
Created September 29, 2012 00:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joncalhoun/3802734 to your computer and use it in GitHub Desktop.
Save joncalhoun/3802734 to your computer and use it in GitHub Desktop.
Buying postage with EasyPost and Ruby
require "easypost"
Easypost.api_key = "ek_0HbTD15HeT6RFTwCKoUQ7rrB2NzMZ"
EasyPost::Postage.buy(
:parcel => {
:weight => 1.1,
:height => 12,
:width => 14,
:length => 7
},
:to => {
:name => "Reed Rothchild",
:street1 => "101 California St",
:street2 => "Suite 1290",
:city => "San Francisco",
:state => "CA",
:zip => "94111"
},
:from => {
:name => "Dirk Diggler",
:phone => "3108085243",
:street1 => "300 Granelli Ave",
:city => "Half Moon Bay",
:state => "CA",
:zip => "94019"
},
:carrier => "USPS",
:service => "Express"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment