HTTPAutorec
HTTPAutorec is a handy tool to add transparent disk caching of HTTP response to your script. All you have to do is adding require 'http_autorec'
.
Installation
Install it yourself as:
$ gem install http_autorec
Or add this line to your application's Gemfile:
gem 'http_autorec'
And then execute:
$ bundle
Usage
Add require 'http_autorec'
, or ruby -r http_autorec yourscript.rb
.
Cache is put on ./http_autorec_cache
by default. You can set the place of cache by HTTP_AUTOREC_DIR=http_cache ruby -r http_autorec yourscript
.
How it works
HTTPAutorec uses VCR and WebMock. VCR records and replays HTTP responses, which are intercepted by WebMock.
WebMock supports a lot of HTTP libraries (check out webmock's readme), and so does HTTPAutorec.
Contributing
- Fork it ( https://github.com/vzvu3k6k/http_autorec/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Related rubygems
-
open-uri-cached -
OpenURI with transparent disk caching
for each process; (README) - http-dump - Dump http request by WebMock; (README)