Skip to content

Instantly share code, notes, and snippets.

@jcla1

jcla1/example.rb

Created Oct 17, 2012
Embed
What would you like to do?
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
You can’t perform that action at this time.