Ruby module to read url for html, text or image with cache.
require 'url_reader'
include UrlReader
read_url('https://www.google.co.jp/')
# => "<!doctype html><html itemscope=\"\"...
If defined?(Rails) && Rails.env.development?
then cache is used.
UrlReader detect image for Content Type matching /^image\//
. You can set image_content_type
option for additional Content Type for image.
headers
Set HTTP headersuser_agent
Set User Agentcookies
Set Cookiestimeout
Set request timeoutopen_timeout
Set request open timeoutmethod
Set HTTP methodignore_errors
Set ignored errorsignore_not_found
Set to ignore 404ignore_server_error
Set to ignore 503params
Set parameters for POST
last_response_headers
Get last response HTTP headerslast_response_cookies
Get last response Cookieslast_cache_used
Get cache was used or not last time