peoplegroup-connectors 0.4.7 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/peoplegroup/connectors/bamboo.rb +5 -10
- data/lib/peoplegroup/connectors/gitlab.rb +3 -10
- data/lib/peoplegroup/connectors/hris.rb +5 -4
- data/lib/peoplegroup/connectors/slack.rb +1 -1
- data/lib/peoplegroup/connectors/version.rb +1 -1
- data/lib/peoplegroup/connectors/workday/client.rb +157 -0
- data/lib/peoplegroup/connectors/workday/report.rb +96 -0
- data/lib/peoplegroup/connectors/workday/xml/get_organizations.rb +85 -0
- data/lib/peoplegroup/connectors/workday/xml/helpers.rb +75 -0
- data/lib/peoplegroup/connectors/workday/xml/request_one_time_payment.rb +105 -0
- data/lib/peoplegroup/connectors/workday/xml.rb +12 -0
- data/lib/peoplegroup/connectors/workday.rb +10 -193
- data/lib/peoplegroup/connectors.rb +5 -4
- metadata +27 -179
- data/lib/peoplegroup/connectors/models/objectified_hash.rb +0 -105
- data/lib/peoplegroup/connectors/xml/get_organizations.rb +0 -84
- data/lib/peoplegroup/connectors/xml/helpers.rb +0 -72
- data/lib/peoplegroup/connectors/xml/request_one_time_payment.rb +0 -103
- data/lib/peoplegroup/connectors/xml.rb +0 -14
@@ -1,84 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_rel 'helpers'
|
4
|
-
|
5
|
-
module PeopleGroup
|
6
|
-
module Connectors
|
7
|
-
module XML
|
8
|
-
# https://community.workday.com/sites/default/files/file-hosting/productionapi/Staffing/v37.2/Get_Organizations.html
|
9
|
-
module GetOrganizations
|
10
|
-
include Helpers
|
11
|
-
|
12
|
-
# The Operation for this Module
|
13
|
-
OPERATION = :get_organizations
|
14
|
-
|
15
|
-
# List all of the active departments.
|
16
|
-
def departments
|
17
|
-
get('Cost_Center')
|
18
|
-
end
|
19
|
-
|
20
|
-
# List all of the active regions.
|
21
|
-
def regions
|
22
|
-
get('Region')
|
23
|
-
end
|
24
|
-
|
25
|
-
# List all of the active entities.
|
26
|
-
def locations
|
27
|
-
@locations ||= get('Company').map(&:reference_id)
|
28
|
-
end
|
29
|
-
|
30
|
-
# List all of the active pay groups.
|
31
|
-
def pay_groups
|
32
|
-
get('Pay_Group')
|
33
|
-
end
|
34
|
-
|
35
|
-
private
|
36
|
-
|
37
|
-
# Call the specified endpoint.
|
38
|
-
# @param type [String] The type of organization to request.
|
39
|
-
# @return [Array<PeopleGroup::Connectors::Models::ObjectifiedHash>] An array of the requested organzation types resources.
|
40
|
-
def get(type, additional = {})
|
41
|
-
options = {
|
42
|
-
**org_request_criteria_by_type(type),
|
43
|
-
**Helpers.default_response_group,
|
44
|
-
**Helpers.pagination_parameters,
|
45
|
-
**additional
|
46
|
-
}
|
47
|
-
|
48
|
-
request = Helpers.construct_options(OPERATION, options)
|
49
|
-
auto_paginated_call(OPERATION, request).map do |data|
|
50
|
-
ObjectifiedHash.new data[:organization_data]
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# Get the Request_Criteria via type
|
55
|
-
# @param type [String] Company, Cost Center, Pay Group, Region
|
56
|
-
#
|
57
|
-
# @return [Request_Criteria] The Organiztion_Request_Criteria for the specified type.
|
58
|
-
def org_request_criteria_by_type(type)
|
59
|
-
org_criteria = organization_request_criteria(type: type)
|
60
|
-
Helpers.request_criteria(org_criteria)
|
61
|
-
end
|
62
|
-
|
63
|
-
# Get the Organization_Request_Criteria as a hash.
|
64
|
-
# @param type [String] The type of Organization to perform the search on.
|
65
|
-
# @param include_inactive [boolean] Whether to include inactive organizations, defaults to false.
|
66
|
-
# @param field_and_param_data [Hash] A Hash containing the key value pair of Field and Parameter Criteria Data.
|
67
|
-
def organization_request_criteria(type:, include_inactive: false, field_and_param_data: nil)
|
68
|
-
hash = {
|
69
|
-
'Organization_Type_Reference' => {
|
70
|
-
'ID' => type,
|
71
|
-
:attributes! => { 'ID' => { 'wd:type' => 'Organization_Type_ID' } }
|
72
|
-
},
|
73
|
-
'Include_Inactive' => include_inactive
|
74
|
-
}
|
75
|
-
|
76
|
-
# Only add parameter criteria if present.
|
77
|
-
hash['Field_And_Parameter_Criteria_Data'] = field_and_param_data unless field_and_param_data.nil?
|
78
|
-
|
79
|
-
hash
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module PeopleGroup
|
4
|
-
module Connectors
|
5
|
-
module XML
|
6
|
-
module Helpers
|
7
|
-
MAX_RESULTS_PER_PAGE = 999
|
8
|
-
|
9
|
-
def self.request_references(refs = {})
|
10
|
-
{
|
11
|
-
'Request_References' => refs
|
12
|
-
}
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.response_filter(filters = {})
|
16
|
-
{
|
17
|
-
'Response_Filter' => filters
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
# Default Request Criteria XML Wrapper
|
22
|
-
# @param criteria [Hash] A list of key value pair XML attributes.
|
23
|
-
#
|
24
|
-
# @return [Hash] - The <wd:Request_Criteria> XML Component containing a set of options.
|
25
|
-
def self.request_criteria(criteria = {})
|
26
|
-
{
|
27
|
-
'Request_Criteria' => criteria
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.response_group(group = {})
|
32
|
-
{ 'Response_Group' => group }
|
33
|
-
end
|
34
|
-
|
35
|
-
def self.default_response_group(additional = {})
|
36
|
-
groups = { 'Include_Hierarchy_Data' => false, **additional }
|
37
|
-
response_group groups
|
38
|
-
end
|
39
|
-
|
40
|
-
# Contructs a hash that we can pass into the #call Savon client method.
|
41
|
-
def self.construct_options(operation, message)
|
42
|
-
operation = operation.to_s.split('_').collect(&:capitalize).join('_') unless operation.is_a?(String)
|
43
|
-
{
|
44
|
-
message_tag: "#{operation}_Request",
|
45
|
-
message: message
|
46
|
-
}
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.pagination_parameters(page = 1, results_per_page = MAX_RESULTS_PER_PAGE)
|
50
|
-
response_filter(
|
51
|
-
{
|
52
|
-
'Page' => page,
|
53
|
-
'Count' => results_per_page
|
54
|
-
}
|
55
|
-
)
|
56
|
-
end
|
57
|
-
|
58
|
-
# The <wd:Employee_Reference> object wrapper.
|
59
|
-
# @param id [Integer] The employee number of the team member.
|
60
|
-
# @return [Hash] The <wd:Employee_Reference> XML wrapper component.
|
61
|
-
def self.team_member_reference(id)
|
62
|
-
{
|
63
|
-
'Employee_Reference' => {
|
64
|
-
'ID' => id,
|
65
|
-
attributes!: { 'ID' => { 'wd:type' => 'Employee_ID' } }
|
66
|
-
}
|
67
|
-
}
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|
@@ -1,103 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_rel 'helpers'
|
4
|
-
|
5
|
-
module PeopleGroup
|
6
|
-
module Connectors
|
7
|
-
module XML
|
8
|
-
# https://community.workday.com/sites/default/files/file-hosting/productionapi/Compensation/v37.0/Request_One-Time_Payment.html
|
9
|
-
module RequestOneTimePayment
|
10
|
-
include Helpers
|
11
|
-
|
12
|
-
# The Operation for this Module
|
13
|
-
OPERATION = :request_one_time_payment
|
14
|
-
OPERATION_AS_PARAM = 'Request_One-Time_Payment'
|
15
|
-
|
16
|
-
# The amount in USD to give for bonuses, must be a decimal.
|
17
|
-
DISCRETIONARY_BONUS = 1000.0
|
18
|
-
|
19
|
-
# Adds a bonus to the team members
|
20
|
-
# @param employee_number [Integer] The Employee Number of the team member receiving the bonus.
|
21
|
-
# @param comment [String] The comment to leave on the business process.
|
22
|
-
def add_bonus(employee_number, comment)
|
23
|
-
options = {
|
24
|
-
**business_process_params(comment),
|
25
|
-
**one_time_payment_data(employee_number, comment)
|
26
|
-
}
|
27
|
-
|
28
|
-
request = Helpers.construct_options(OPERATION_AS_PARAM, options)
|
29
|
-
call(OPERATION, request)
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
# https://community.workday.com/sites/default/files/file-hosting/productionapi/Compensation/v37.0/Request_One-Time_Payment.html#Business_Process_ParametersType
|
35
|
-
# @param comment [String] The comment associated with the bonus.
|
36
|
-
# @param run_now: [Boolean] Defaults to true to process this transaction immediatley.
|
37
|
-
# @param auto_complete: [Boolean] Defaults to true to apply this bonus without needing approval.
|
38
|
-
#
|
39
|
-
# @return [Hash] The <wd:Business_Process_Parameters> for this request.
|
40
|
-
def business_process_params(comment, run_now: true, auto_complete: true)
|
41
|
-
{
|
42
|
-
'Business_Process_Parameters' => {
|
43
|
-
'Auto_Complete' => auto_complete,
|
44
|
-
'Run_Now' => run_now,
|
45
|
-
|
46
|
-
# Comment Data
|
47
|
-
# https://community.workday.com/sites/default/files/file-hosting/productionapi/Compensation/v37.0/Request_One-Time_Payment.html#Business_Process_Comment_DataType
|
48
|
-
'Comment_Data' => {
|
49
|
-
'Comment' => comment
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
53
|
-
end
|
54
|
-
|
55
|
-
# The Effective Date parameter for when to apply the payment, defaults to today.
|
56
|
-
# @param date [Date] The day to apply the payment.
|
57
|
-
# @return [Hash] The <wd:Effective_Date> parameter set to the specified date.
|
58
|
-
def effective_date(date = Date.today)
|
59
|
-
{
|
60
|
-
'Effective_Date' => date.to_s
|
61
|
-
}
|
62
|
-
end
|
63
|
-
|
64
|
-
# The payment specific data for what should be applied.
|
65
|
-
# @param comment [String] The comment for the discretionary bonus.
|
66
|
-
# @param amount [Double] The amount to include in the bonus with decimal accuracy.
|
67
|
-
def one_time_payment_sub_data(comment, amount = DISCRETIONARY_BONUS)
|
68
|
-
{
|
69
|
-
'One-Time_Payment_Sub_Data' => {
|
70
|
-
**payment_plan_reference,
|
71
|
-
'Amount' => amount,
|
72
|
-
'Comment' => comment
|
73
|
-
}
|
74
|
-
}
|
75
|
-
end
|
76
|
-
|
77
|
-
# The type of one time payment we want to group this under.
|
78
|
-
def payment_plan_reference
|
79
|
-
{
|
80
|
-
'One_Time_Payment_Plan_Reference' => {
|
81
|
-
'ID' => 'Discretionary Bonus',
|
82
|
-
attributes!: { 'ID' => { 'wd:type' => 'One-Time_Payment_Plan_ID' } }
|
83
|
-
}
|
84
|
-
}
|
85
|
-
end
|
86
|
-
|
87
|
-
# https://community.workday.com/sites/default/files/file-hosting/productionapi/Compensation/v37.0/Request_One-Time_Payment.html#Request_One-Time_Payment_DataType
|
88
|
-
# @param employee_number [Integer] The team member's employee number.
|
89
|
-
# @param comment [String] A comment describing why the payment is being requested.
|
90
|
-
# @return [Hash] The <wd:One-Time_Payment_Data> component.
|
91
|
-
def one_time_payment_data(employee_number, comment)
|
92
|
-
{
|
93
|
-
'One-Time_Payment_Data' => {
|
94
|
-
**Helpers.team_member_reference(employee_number),
|
95
|
-
**effective_date,
|
96
|
-
**one_time_payment_sub_data(comment)
|
97
|
-
}
|
98
|
-
}
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_rel 'xml'
|
4
|
-
require_rel 'models/objectified_hash'
|
5
|
-
|
6
|
-
module PeopleGroup::Connectors
|
7
|
-
module XML
|
8
|
-
include GetOrganizations
|
9
|
-
include RequestOneTimePayment
|
10
|
-
|
11
|
-
# Rename Objectified hash for ease of use.
|
12
|
-
ObjectifiedHash = PeopleGroup::Connectors::Models::ObjectifiedHash
|
13
|
-
end
|
14
|
-
end
|