Method: Rubytter::Connection#initialize
- Defined in:
- lib/rubytter/connection.rb
#initialize(options = {}) ⇒ Connection
Returns a new instance of Connection.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rubytter/connection.rb', line 6 def initialize( = {}) @proxy_host = [:proxy_host] @proxy_port = [:proxy_port] @proxy_user = [:proxy_user_name] @proxy_password = [:proxy_password] @proxy_uri = nil @enable_ssl = [:enable_ssl] if @enable_ssl @protocol = "https" @port = 443 else @protocol = "http" @port = 80 end if @proxy_host @http_class = Net::HTTP::Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_password) @proxy_uri = "#{@protocol}://" + @proxy_host + ":" + @proxy_port.to_s + "/" else @http_class = Net::HTTP end end |