Class: MxHero::API::Directory
- Inherits:
-
Object
- Object
- MxHero::API::Directory
- Defined in:
- lib/directories.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#base ⇒ Object
Returns the value of attribute base.
-
#dn_authenticate ⇒ Object
Returns the value of attribute dn_authenticate.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#error ⇒ Object
Returns the value of attribute error.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#last_update ⇒ Object
Returns the value of attribute last_update.
-
#next_update ⇒ Object
Returns the value of attribute next_update.
-
#override ⇒ Object
Returns the value of attribute override.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#type ⇒ Object
Returns the value of attribute type.
-
#useMailAsMain ⇒ Object
Returns the value of attribute useMailAsMain.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Directory
constructor
A new instance of Directory.
- #to_hash ⇒ Object
- #to_json ⇒ Object
- #update_properties(properties) ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Directory
Returns a new instance of Directory.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/directories.rb', line 9 def initialize(data = {}) return if data.empty? [ :domain, [:type, :directoryType], [:address, :addres], :port, [:ssl, :sslFlag], :user, :password, :filter, :base, [:next_update, :nextUpdate], [:last_update, :lastUpdate], :error, [:override, :overrideFlag], [:dn_authenticate, :dnAuthenticate], :useMailAsMain ].each do |property| case property when Symbol send "#{property}=", data[property] when Array send "#{property.first}=", data[property.first] || data[property.last] end end load_properties(data) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
4 5 6 |
# File 'lib/directories.rb', line 4 def address @address end |
#base ⇒ Object
Returns the value of attribute base.
4 5 6 |
# File 'lib/directories.rb', line 4 def base @base end |
#dn_authenticate ⇒ Object
Returns the value of attribute dn_authenticate.
4 5 6 |
# File 'lib/directories.rb', line 4 def dn_authenticate @dn_authenticate end |
#domain ⇒ Object
Returns the value of attribute domain.
4 5 6 |
# File 'lib/directories.rb', line 4 def domain @domain end |
#error ⇒ Object
Returns the value of attribute error.
4 5 6 |
# File 'lib/directories.rb', line 4 def error @error end |
#filter ⇒ Object
Returns the value of attribute filter.
4 5 6 |
# File 'lib/directories.rb', line 4 def filter @filter end |
#last_update ⇒ Object
Returns the value of attribute last_update.
4 5 6 |
# File 'lib/directories.rb', line 4 def last_update @last_update end |
#next_update ⇒ Object
Returns the value of attribute next_update.
4 5 6 |
# File 'lib/directories.rb', line 4 def next_update @next_update end |
#override ⇒ Object
Returns the value of attribute override.
4 5 6 |
# File 'lib/directories.rb', line 4 def override @override end |
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/directories.rb', line 4 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
4 5 6 |
# File 'lib/directories.rb', line 4 def port @port end |
#properties ⇒ Object
Returns the value of attribute properties.
4 5 6 |
# File 'lib/directories.rb', line 4 def properties @properties end |
#ssl ⇒ Object
Returns the value of attribute ssl.
4 5 6 |
# File 'lib/directories.rb', line 4 def ssl @ssl end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/directories.rb', line 4 def type @type end |
#useMailAsMain ⇒ Object
Returns the value of attribute useMailAsMain.
4 5 6 |
# File 'lib/directories.rb', line 4 def useMailAsMain @useMailAsMain end |
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'lib/directories.rb', line 4 def user @user end |
Instance Method Details
#to_hash ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/directories.rb', line 43 def to_hash { domain: domain, directoryType: type, addres: address, port: port, sslFlag: ssl, # || false, user: user, password: password, filter: filter, base: base, nextUpdate: next_update, # || DateTime.now.strftime('%Q'), lastUpdate: last_update, # || DateTime.now.strftime('%Q'), error: error, overrideFlag: override, #override.nil? ? true : override, dnAuthenticate: dn_authenticate, useMailAsMain: useMailAsMain, properties: properties_field_to_hash } end |
#to_json ⇒ Object
62 63 64 |
# File 'lib/directories.rb', line 62 def to_json to_hash.to_json end |
#update_properties(properties) ⇒ Object
39 40 41 |
# File 'lib/directories.rb', line 39 def update_properties(properties) properties.each { |prop, value| send("#{prop}=", value) if respond_to?("#{prop}=") } end |