Skip to content

Instantly share code, notes, and snippets.

@jcla1
Created October 17, 2012 12:42
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 jcla1/3905335 to your computer and use it in GitHub Desktop.
Save jcla1/3905335 to your computer and use it in GitHub Desktop.
ZipPlease Ruby Example
require 'sinatra'
require 'rest_client'
require 'uuid'
require 'json'
# For generating UUIDs
uuid = UUID.new
zipPleaseAPIEndpoint = "http://www.zipplease.com/api/zips"
post '/demo/flickr' do
images = params[:images]
uniqueZipName = "zipPleaseFlickrDemo_" + uuid.generate() + ".zip";
zipRequest = {
"accountKey" => "6B5qClA0SG2er7x7PmZTK4QU", # Not real.
"accountSecret" => "jHxRb2y3CevJyROL96hYKcE0oAI", # Get your own.
"zipName" => uniqueZipName,
"files" => images,
"compress" => false
}
response = RestClient.post zipPleaseAPIEndpoint, zipRequest.to_json
response.to_s
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment