Skip to content

Instantly share code, notes, and snippets.

@solkennedy
Created August 6, 2012 18:42
Show Gist options
  • Save solkennedy/3277418 to your computer and use it in GitHub Desktop.
Save solkennedy/3277418 to your computer and use it in GitHub Desktop.
Ship API Ruby Example
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 => "pepper@sincerely.com",
: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