Method: ADCK::Connection#initialize
- Defined in:
- lib/adck/connection.rb
#initialize(opts = {}) ⇒ Connection
Returns a new instance of Connection.
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/adck/connection.rb', line 3 def initialize(opts={}) @host = opts[:host]||ADCK.host @port = opts[:port]||ADCK.port @pem = opts[:pem] ||ADCK.pem @pass = opts[:pass]||ADCK.pass raise "The path to your pem file is not set. (ADCK.pem = /path/to/cert.pem)" unless @pem raise "The path to your pem file does not exist!" unless File.exist?(@pem) @context = OpenSSL::SSL::SSLContext.new @context.cert = OpenSSL::X509::Certificate.new(File.read(@pem)) @context.key = OpenSSL::PKey::RSA.new(File.read(@pem), @pass) end |