Created
August 6, 2012 18:42
-
-
Save solkennedy/3277418 to your computer and use it in GitHub Desktop.
Ship API Ruby Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rest-client' | |
require 'json' | |
url = 'https://snapi.sincerely.com/shiplib/create' | |
request = { | |
:appkey => ENV["YOUR_APP_KEY"], | |
:testMode => true, | |
:frontPhotoId => 123456, | |
:recipients => [ | |
{ | |
:name => "Jane Doe", | |
:street1 => "123 Mission Street", | |
:city => "San Francisco", | |
:state => "CA", | |
:postalcode => "94105", | |
:country => "UNITED STATES" | |
} | |
].to_json, | |
:sender => { | |
:name => "Pepper Gram", | |
:email => "[email protected]", | |
:street1 => "800 Market Street", | |
:city => "San Francisco", | |
:state => "CA", | |
:postalcode => "94105", | |
:country => "UNITED STATES" | |
}.to_json | |
} | |
resp = RestClient.post(url,request,:accept=>:json) | |
JSON.parse(resp) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment