Class: OpenldapMonitorExtractor::Connection
- Inherits:
-
Object
- Object
- OpenldapMonitorExtractor::Connection
- Defined in:
- lib/openldap_monitor_extractor/connection.rb
Constant Summary collapse
- DEFAULT_MONITOR_BASE =
"cn=Monitor"
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(parameters = { }) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(parameters = { }) ⇒ Connection
Returns a new instance of Connection.
36 37 38 39 40 41 |
# File 'lib/openldap_monitor_extractor/connection.rb', line 36 def initialize(parameters={ }) @connection = Connection::builder(parameters) self end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
12 13 14 |
# File 'lib/openldap_monitor_extractor/connection.rb', line 12 def connection @connection end |
Class Method Details
.builder(parameters = { }) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/openldap_monitor_extractor/connection.rb', line 14 def self.builder(parameters={ }) parameters = { :base =>DEFAULT_MONITOR_BASE }.merge(parameters) uri = URI.parse(parameters[:url]) auth = { :method =>:simple, :username =>parameters[:username], :password =>parameters[:password] } cparameters = { :host =>uri.host, :port =>uri.port, :base =>parameters[:base], :auth =>auth } cparameters[:encryption] = { :method =>:simple_tls } if uri.scheme == "ldaps" Net::LDAP.new(cparameters) end |