Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

shadow11-middleman

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shadow11-middleman

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 10 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc