Sha256: 8b8b9e3d911c8e0dba88a8f015a6693b274c0c9a2161c9fc19577830a0fbbcef

Contents?: true

Size: 567 Bytes

Versions: 7

Compression:

Stored size: 567 Bytes

Contents

module Stylesheet
  class Request
    def get(url)
      curl = Curl::Easy.perform(url) do |curl| 
        curl.headers["User-Agent"] = user_agent
        curl.follow_location       = true
      end

      curl.body_str

    rescue Stylesheet::Error
      raise

    # re-raise external library errors in our namespace
    rescue => error
      raise Stylesheet::Error.new("#{error.class}: #{error.message}")
    end

    def user_agent
      "Ruby/Stylesheet Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
stylesheet-0.1.8 lib/stylesheet/request.rb
stylesheet-0.1.7 lib/stylesheet/request.rb
stylesheet-0.1.6 lib/stylesheet/request.rb
stylesheet-0.1.5 lib/stylesheet/request.rb
stylesheet-0.1.4 lib/stylesheet/request.rb
stylesheet-0.1.3 lib/stylesheet/request.rb
stylesheet-0.1.1 lib/stylesheet/request.rb