Sha256: dbfc8ee10015af3cb0d1551b10bff00f289b4862729486ca0a4c9a82a15b742f
Contents?: true
Size: 911 Bytes
Versions: 1
Compression:
Stored size: 911 Bytes
Contents
module Mirage module Web class FileResponse def initialize response @response = response end def save_as path @response.save_as(path) end end def http_get url, params={} using_mechanize do |browser| params[:body] ? browser.put(url, params[:body]) : browser.get(url, params) end end def http_post url, params={} using_mechanize do |browser| browser.post(url, params) end end private def using_mechanize begin browser = Mechanize.new browser.keep_alive = false response = yield browser def response.code @code.to_i end rescue Exception => e response = e def response.code self.response_code.to_i end def response.body "" end end response end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mirage-1.3.6 | lib/mirage/web.rb |