I'm hoping to flesh this out more in the future. For now, here's something I threw together recently. It's a Capistrano task for compressing your Rails app's stylesheets on deploy so that they will be smaller for your clients to download:
require 'rubygems' require 'httparty' require 'md5' class Flickr include HTTParty base_uri 'http://www.flickr.com/services/' def initialize(api_key=API_KEY, shared_secret=SHARED_SECRET) @api_key = api_key @shared_secret = shared_secret @frob = request('flickr.auth.getFrob')['frob'] args = {'api_key' => api_key, 'perms' => 'delete', 'frob' => @frob } arg_string = args.collect {|a| a.join('=').join('&') p "Please go to: http://flickr.com/services/auth/?#{arg_string}&api_sig=#{sign(args)}" end def request(method, args = {}) if !@token and method != 'flickr.auth.getToken' and method != 'flickr.auth.getFrob' result = request('flickr.auth.getToken', {'frob' => @frob, 'perms' => 'delete'}) @token = result['auth']['token'] end args['method'] = method args['api_key'] = @api_key args['auth_token'] = @token if @token args['api_sig'] = sign(args) self.class.get("/rest/", :query => args)["rsp"] end private def args_array(hash) hash.collect {|pair| pair.join }.sort end def sign(args) args = args_array(args) if args.is_a?(Hash) return MD5.md5(@shared_secret + args.sort.flatten.join).to_s end end