Description
Ruby module to read url for html, text or image with cache.
Usage
require 'url_reader'
include UrlReader
read_url('https://www.google.co.jp/')
# => "<!doctype html><html itemscope=\"\"...
Cache
If defined?(Rails) && Rails.env.development? then cache is used.
Image
UrlReader detect image for Content Type matching /^image\//. You can set image_content_type option for additional Content Type for image.
Options
-
headersSet HTTP headers -
user_agentSet User Agent -
cookiesSet Cookies -
timeoutSet request timeout -
open_timeoutSet request open timeout -
methodSet HTTP method -
ignore_errorsSet ignored errors -
ignore_not_foundSet to ignore 404 -
ignore_server_errorSet to ignore 503 -
paramsSet parameters for POST
Class attributes
-
last_response_headersGet last response HTTP headers -
last_response_cookiesGet last response Cookies -
last_cache_usedGet cache was used or not last time