github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

rlivsey / middleman

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 2
    • 1
  • Source
  • Commits
  • Network (1)
  • Issues (1)
  • Downloads (1)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (1)
    • v0.0.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

simple logging/caching proxy for Net::HTTP — Read more

  cancel

http://livsey.org

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

update gemspec 
Richard Livsey (author)
Fri May 08 09:03:54 -0700 2009
commit  ae6708667884caa4ec397730ca4cb325dfd57acc
tree    a07283c18ab89a31690bba722dbb69a0d19ed6ca
parent  21abe416f718e32470044da3cebb0aec0c4027de
middleman /
name age
history
message
file .gitignore Loading commit data...
file MIT-LICENSE
file README.markdown
file RakeFile
file VERSION
directory lib/
file middleman.gemspec
directory spec/
README.markdown

About

Middleman is a simple logging/caching proxy for Net::HTTP which can make developing against remote services easier (especially if they have API limits).

By default, it caches to a file, so the cache is persistent across multiple runs of your app.

Installation

gem sources -a http://gems.github.com sudo gem install rlivsey-middleman

Example usage

require 'rubygems'
require 'twitter'
gem 'middleman'
require 'middleman'

Twitter::Search.new('bacon') # makes the request to Twitter
Twitter::Search.new('bacon') # same search, so returns from the cache

Options

Output information to the console

Middleman.options[:verbose] = true

Change the store used for the cache, see the 'stores' section below for more information, but it's basically an object which acts like a Hash

Middleman.options[:store] = {}

Change where verbose output is sent, by default it's STDOUT

Middleman.options[:logger] = Logger.new('middleman.log')

Stores

By default Middleman uses Middleman::Store::File to cache the requests to files in a directory. The file names are MD5 hashes of the request details.

The interface to Middleman::Store::File is basically a Hash, so any object which responds to [], []= and is enumerable can be used as a store.

Using a Hash for the store will work fine, but will not persist across runs of your application.

Notes

At the moment this only works against Net::HTTP. I've got plans to make it easier to extend and add the ability to work with other libraries such as Curb etc...

Feel free to fork and send in patches.

Me

  • Home & Contact info: http://livsey.org
  • Twitter: http://twitter.com/rlivsey
  • GitHub: http://github.com/rlivsey
  • Recommend: http://www.workingwithrails.com/person/5436-richard-livsey
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server