Class: ActiveResource::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/twitty-console/proxy-patch.rb

Constant Summary collapse

@@proxy_host =
@@proxy_port = @@proxy_user = @@proxy_pass = nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.proxy_host=(proxy_host) ⇒ Object



19
20
21
# File 'lib/twitty-console/proxy-patch.rb', line 19

def self.proxy_host= proxy_host
  @@proxy_host = proxy_host
end

.proxy_password=(proxy_pass) ⇒ Object



31
32
33
# File 'lib/twitty-console/proxy-patch.rb', line 31

def self.proxy_password= proxy_pass
  @@proxy_pass = proxy_pass
end

.proxy_port=(proxy_port) ⇒ Object



23
24
25
# File 'lib/twitty-console/proxy-patch.rb', line 23

def self.proxy_port= proxy_port
  @@proxy_port = proxy_port
end

.proxy_user=(proxy_user) ⇒ Object



27
28
29
# File 'lib/twitty-console/proxy-patch.rb', line 27

def self.proxy_user= proxy_user
  @@proxy_user = proxy_user
end

Instance Method Details

#httpObject



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/twitty-console/proxy-patch.rb', line 35

def http
  if @@proxy_host && @@proxy_port
    http_class = Net::HTTP::Proxy(@@proxy_host, @@proxy_port,
                                  @@proxy_user, @@proxy_pass)
  else
    http_class = Net::HTTP
  end
  http = http_class.new(@site.host, @site.port)
  http.use_ssl = @site.is_a?(URI::HTTPS)
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE if http.use_ssl
  http
end