Sha256: fb6b51742f9a6af7264f2c6c658cfdc0c45c24f6ec3a7aed4f0fd7d27b25822a

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

require 'curl'

module Iconoclasm
  module Downloader

    @@user_agent = 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)'
    
    def self.user_agent=(agent)
      @@user_agent = agent
    end
    
    def self.user_agent
      @@user_agent
    end
    
    def get(url)
      Curl::Easy.http_get(url) do |curl|
        curl.headers['User-Agent']  = Iconoclasm::Downloader.user_agent
        curl.follow_location        = true
      end
    end
    
    def head(url)
      Curl::Easy.http_head(url) do |curl|
        curl.headers['User-Agent']  = Iconoclasm::Downloader.user_agent
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
iconoclasm-1.0.0 lib/iconoclasm/downloader.rb