Class: Ucert::AdpPayrollTracker
- Inherits:
-
Object
- Object
- Ucert::AdpPayrollTracker
- Includes:
- Utils
- Defined in:
- lib/ucert/adp_payroll_tracker.rb
Overview
Class to handle Active Employee list within the ADP Payroll report
Instance Attribute Summary collapse
-
#adp_2_ad_user ⇒ Object
readonly
Returns the value of attribute adp_2_ad_user.
-
#employee ⇒ Object
readonly
Returns the value of attribute employee.
-
#employee_report ⇒ Object
Class constant variables.
-
#file_adp_user_map ⇒ Object
Class constant variables.
-
#verbose ⇒ Object
Class constant variables.
Instance Method Summary collapse
-
#adp_search_by_dn(dn) ⇒ Object
(also: #search_by_dn)
Search user entitlement record by AD DN.
-
#dn_2_index(dn) ⇒ Object
Retrieve the user index from the @employee data structure.
-
#initialize(params = {}) ⇒ AdpPayrollTracker
constructor
Instance default variables.
Methods included from Utils
#file_2_list, #is_fqdn?, #is_ip?, #is_url?, #list_2_file, #load_known_user_map_from_file, #nslookup, #search_ad, #update_dn
Constructor Details
#initialize(params = {}) ⇒ AdpPayrollTracker
Instance default variables
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ucert/adp_payroll_tracker.rb', line 20 def initialize (params ={}) @verbose=params.fetch(:verbose, false) # ADP Payroll report generation: # Contact CMBNY HR Manager to obtain the report monthly in Excel Workbook @employee_report = File.dirname(__FILE__)+"/../../data/adp/Active Employee Report.xlsx" # ADP Payroll to AD user map file @file_adp_user_map = File.dirname(__FILE__)+"/../../data/adp/adp_user_map.txt" @employee = Hash.new # Load user map from the local cacsh file @adp_2_ad_user=load_known_user_map_from_file(@file_adp_user_map) # Read the active employee report @employee=parse_adp_payroll_report(@employee_report) # Procedure to add DN foreign key to the @employee, by performing the AD search insert_dn # Save the user map to local cache file save! end |
Instance Attribute Details
#adp_2_ad_user ⇒ Object (readonly)
Returns the value of attribute adp_2_ad_user.
17 18 19 |
# File 'lib/ucert/adp_payroll_tracker.rb', line 17 def adp_2_ad_user @adp_2_ad_user end |
#employee ⇒ Object (readonly)
Returns the value of attribute employee.
17 18 19 |
# File 'lib/ucert/adp_payroll_tracker.rb', line 17 def employee @employee end |
#employee_report ⇒ Object
Class constant variables
16 17 18 |
# File 'lib/ucert/adp_payroll_tracker.rb', line 16 def employee_report @employee_report end |
#file_adp_user_map ⇒ Object
Class constant variables
16 17 18 |
# File 'lib/ucert/adp_payroll_tracker.rb', line 16 def file_adp_user_map @file_adp_user_map end |
#verbose ⇒ Object
Class constant variables
16 17 18 |
# File 'lib/ucert/adp_payroll_tracker.rb', line 16 def verbose @verbose end |
Instance Method Details
#adp_search_by_dn(dn) ⇒ Object Also known as: search_by_dn
Search user entitlement record by AD DN
174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/ucert/adp_payroll_tracker.rb', line 174 def adp_search_by_dn (dn) begin puts "Perform search on the user entitlement records by AD DN: #{dn}" if @verbose @employee.each do |key, val| return val if @employee[key]['DN'].eql? dn end return nil rescue => ee puts "Exception on method #{__method__}: #{ee}" end end |
#dn_2_index(dn) ⇒ Object
Retrieve the user index from the @employee data structure
85 86 87 88 89 90 91 92 93 |
# File 'lib/ucert/adp_payroll_tracker.rb', line 85 def dn_2_index (dn) begin (1..@employee.count).map do |index| return index if @employee[index]["DN"]==dn end rescue => ee puts "Exception on method #{__method__}: #{ee}" end end |