From 16ee376bdb84be48169dd8eb40090670810aa727 Mon Sep 17 00:00:00 2001 From: Aaron Alexander Date: Tue, 27 Jan 2015 18:20:42 -0500 Subject: [PATCH] Adding HTTP Proxy options --- lib/mmonit/connection.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/mmonit/connection.rb b/lib/mmonit/connection.rb index bb7dc09..299e74e 100644 --- a/lib/mmonit/connection.rb +++ b/lib/mmonit/connection.rb @@ -4,7 +4,7 @@ module MMonit class Connection - attr_reader :http, :address, :port, :ssl, :username, :useragent, :headers + attr_reader :http, :address, :port, :ssl, :username, :useragent, :proxy_address, :proxy_port, :headers attr_writer :password def initialize(options = {}) @@ -16,6 +16,8 @@ def initialize(options = {}) @password = options[:password] options[:useragent] ||= "MMonit-Ruby/#{MMonit::VERSION}" @useragent = options[:useragent] + @proxy_address = options[:proxy_address] + @proxy_port = options[:proxy_port] @headers = { 'Host' => @address, 'Referer' => "#{@url}/index.csp", @@ -26,7 +28,7 @@ def initialize(options = {}) end def connect - @http = Net::HTTP.new(@address, @port) + @http = Net::HTTP.new(@address, @port, @proxy_address, @proxy_port) if @ssl @http.use_ssl = true