stackone_migration 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -4
- data/lib/stackone_migration/api/employees_api.rb +2 -2
- data/lib/stackone_migration/mappers/employees_mapper.rb +21 -11
- data/lib/stackone_migration/version.rb +1 -1
- data/spec/api/employees_api_spec.rb +6 -6
- data/spec/mappers/employees_mapper_spec.rb +54 -37
- data/stackone_migration.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6813d14400fc237d5f222a228470bdbd2e8977d5ca735a6f3b16d2bdc7608e6
|
4
|
+
data.tar.gz: 3b75ed197dce2a96019ffe121c4a438047d5aec85d45dbe97f2e7c767b1002d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35249c393424ad0d863ad36c13a48d5d05570d4ce48c5b1b7ff2a4cfe84eb6210761b5c55eaff40d910fec9649776653aa2c13a3819ad2e3990ace79e41892d1
|
7
|
+
data.tar.gz: d4eeebe7d72a8faa739f2461816f687e2516b24b22f872ceed2b69047c76339614c69efec1122232bed5b532f54b4d4bead70413f5a77c9ed91120aecac3b9a6
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
stackone_migration (1.4.
|
4
|
+
stackone_migration (1.4.5)
|
5
5
|
merge_hris_client (~> 3.0)
|
6
|
-
stackone_hris_client (~> 1.
|
6
|
+
stackone_hris_client (~> 1.6.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
@@ -58,7 +58,7 @@ GEM
|
|
58
58
|
rubocop-ast (1.27.0)
|
59
59
|
parser (>= 3.2.1.0)
|
60
60
|
ruby-progressbar (1.13.0)
|
61
|
-
stackone_hris_client (1.
|
61
|
+
stackone_hris_client (1.6.0)
|
62
62
|
typhoeus (~> 1.0, >= 1.0.1)
|
63
63
|
typhoeus (1.4.0)
|
64
64
|
ethon (>= 0.9.0)
|
@@ -73,7 +73,7 @@ DEPENDENCIES
|
|
73
73
|
rake (~> 13.0.1)
|
74
74
|
rspec (~> 3.6, >= 3.6.0)
|
75
75
|
rubocop (~> 1.48.0)
|
76
|
-
stackone_hris_client (~> 1.
|
76
|
+
stackone_hris_client (~> 1.6.0)
|
77
77
|
stackone_migration!
|
78
78
|
|
79
79
|
BUNDLED WITH
|
@@ -15,12 +15,12 @@ module MergeHRISClient
|
|
15
15
|
|
16
16
|
if opts.key?(:remote_id)
|
17
17
|
stripped_opts = opts.reject { |k, _| k == :remote_id }
|
18
|
-
response = StackOneHRIS::EmployeesApi.new.
|
18
|
+
response = StackOneHRIS::EmployeesApi.new.hris_employees_get(opts[:remote_id], x_account_id,
|
19
19
|
stripped_opts)
|
20
20
|
|
21
21
|
StackOneMigration::EmployeesMapper.map_single_employee_to_list_model(response&.data)
|
22
22
|
else
|
23
|
-
response = StackOneHRIS::EmployeesApi.new.
|
23
|
+
response = StackOneHRIS::EmployeesApi.new.hris_employees_list(x_account_id, opts)
|
24
24
|
|
25
25
|
StackOneMigration::EmployeesMapper.map_to_paginated_employee_list_model(response)
|
26
26
|
end
|
@@ -97,18 +97,18 @@ module StackOneMigration
|
|
97
97
|
:first_name => employee.first_name,
|
98
98
|
:last_name => employee.last_name,
|
99
99
|
:display_full_name => employee.display_name,
|
100
|
-
:avatar => employee.
|
100
|
+
:avatar => employee.avatar_url,
|
101
101
|
:personal_email => employee.personal_email,
|
102
102
|
:work_email => employee.work_email,
|
103
103
|
:mobile_phone_number => employee.personal_phone_number || employee.work_phone_number,
|
104
|
-
:gender => MergeHRISClient::GenderEnum
|
104
|
+
:gender => build_merge_enum(MergeHRISClient::GenderEnum, gender_enum_hash, employee.gender),
|
105
105
|
:date_of_birth => employee.date_of_birth,
|
106
106
|
:start_date => employee.start_date,
|
107
107
|
:manager => employee.manager_id,
|
108
|
-
:ethnicity => MergeHRISClient::EthnicityEnum
|
109
|
-
:marital_status => MergeHRISClient::MaritalStatusEnum
|
108
|
+
:ethnicity => build_merge_enum(MergeHRISClient::EthnicityEnum, ethnicity_enum_hash, employee.ethnicity),
|
109
|
+
:marital_status => build_merge_enum(MergeHRISClient::MaritalStatusEnum, marital_status_enum_hash, employee.marital_status),
|
110
110
|
:hire_date => employee.hire_date,
|
111
|
-
:employment_status => MergeHRISClient::EmploymentStatusEnum
|
111
|
+
:employment_status => build_merge_enum(MergeHRISClient::EmploymentStatusEnum, employment_status_enum_hash, employee.employment_status),
|
112
112
|
:termination_date => employee.termination_date,
|
113
113
|
:home_location => map_to_location_model(employee.home_location),
|
114
114
|
:work_location => map_to_location_model(employee.work_location),
|
@@ -126,11 +126,11 @@ module StackOneMigration
|
|
126
126
|
:phone_number => location.phone_number,
|
127
127
|
:street_1 => location.street_1,
|
128
128
|
:street_2 => location.street_2,
|
129
|
-
:city => location.city,
|
129
|
+
:city => location.city || location.name,
|
130
130
|
:state => location.state,
|
131
131
|
:zip_code => location.zip_code,
|
132
132
|
:country => map_country_enum(location.country),
|
133
|
-
:location_type => MergeHRISClient::LocationTypeEnum
|
133
|
+
:location_type => build_merge_enum(MergeHRISClient::LocationTypeEnum, location_type_enum_hash, location.location_type),
|
134
134
|
)
|
135
135
|
end
|
136
136
|
|
@@ -140,11 +140,11 @@ module StackOneMigration
|
|
140
140
|
MergeHRISClient::Employment.new(
|
141
141
|
:job_title => employment.job_title,
|
142
142
|
:pay_rate => employment.pay_rate,
|
143
|
-
:pay_period => MergeHRISClient::PayPeriodEnum
|
144
|
-
:pay_frequency => MergeHRISClient::PayFrequencyEnum
|
143
|
+
:pay_period => build_merge_enum(MergeHRISClient::PayPeriodEnum, pay_period_enum_hash, employment.pay_period),
|
144
|
+
:pay_frequency => build_merge_enum(MergeHRISClient::PayFrequencyEnum, pay_frequency_enum_hash, employment.pay_frequency),
|
145
145
|
:pay_currency => MergeHRISClient::PayCurrencyEnum.build_from_hash(employment.pay_currency&.to_s&.upcase),
|
146
146
|
:effective_date => employment.effective_date,
|
147
|
-
:employment_type => MergeHRISClient::EmploymentTypeEnum
|
147
|
+
:employment_type => build_merge_enum(MergeHRISClient::EmploymentTypeEnum, employment_type_enum_hash, employment.employment_type),
|
148
148
|
)
|
149
149
|
end
|
150
150
|
|
@@ -188,6 +188,13 @@ module StackOneMigration
|
|
188
188
|
)
|
189
189
|
end
|
190
190
|
|
191
|
+
def self.build_merge_enum(enum_class, enum_hash, stackone_enum)
|
192
|
+
merge_enum = enum_class.build_from_hash(map_enum(enum_hash, stackone_enum))
|
193
|
+
merge_enum.raw_value = stackone_enum.source_value unless stackone_enum.nil?
|
194
|
+
|
195
|
+
merge_enum
|
196
|
+
end
|
197
|
+
|
191
198
|
def self.map_enum(enum_hash, enum)
|
192
199
|
return nil if enum.nil? || enum.value.nil?
|
193
200
|
|
@@ -202,7 +209,10 @@ module StackOneMigration
|
|
202
209
|
|
203
210
|
enum_value = enum.value != 'unmapped_value' ? enum.value : enum.source_value
|
204
211
|
|
205
|
-
MergeHRISClient::CountryEnum.build_from_hash(enum_value)
|
212
|
+
country_enum = MergeHRISClient::CountryEnum.build_from_hash(enum_value)
|
213
|
+
country_enum.raw_value = enum.source_value unless enum.nil?
|
214
|
+
|
215
|
+
country_enum
|
206
216
|
end
|
207
217
|
end
|
208
218
|
end
|
@@ -9,11 +9,11 @@ describe MergeHRISClient::EmployeesApi do
|
|
9
9
|
context 'when the account id is from StackOne' do
|
10
10
|
it 'calls the method from the StackOne client to list employees' do
|
11
11
|
paginated_employees_double = double('StackOneHRIS::PaginatedEmployeeList', :data => nil, :next_page => nil)
|
12
|
-
stackone_employees_api_double = double('StackOneHRIS::EmployeesApi', :
|
12
|
+
stackone_employees_api_double = double('StackOneHRIS::EmployeesApi', :hris_employees_list => paginated_employees_double)
|
13
13
|
allow(StackOneHRIS::EmployeesApi).to receive(:new).and_return(stackone_employees_api_double)
|
14
14
|
options = { :expand => 'employments,home_location' }
|
15
15
|
|
16
|
-
expect(stackone_employees_api_double).to receive(:
|
16
|
+
expect(stackone_employees_api_double).to receive(:hris_employees_list).with('123', options)
|
17
17
|
|
18
18
|
subject.employees_list('123', options)
|
19
19
|
end
|
@@ -21,11 +21,11 @@ describe MergeHRISClient::EmployeesApi do
|
|
21
21
|
context 'and the remote id param is in the options' do
|
22
22
|
it 'calls the method from the StackOne client to get an employee with remote id parameter' do
|
23
23
|
paginated_employees_double = double('StackOneHRIS::PaginatedEmployeeList', :data => nil)
|
24
|
-
stackone_employees_api_double = double('StackOneHRIS::EmployeesApi', :
|
24
|
+
stackone_employees_api_double = double('StackOneHRIS::EmployeesApi', :hris_employees_get => paginated_employees_double)
|
25
25
|
allow(StackOneHRIS::EmployeesApi).to receive(:new).and_return(stackone_employees_api_double)
|
26
26
|
options = { :expand => 'employments,home_location', :remote_id => '456' }
|
27
27
|
|
28
|
-
expect(stackone_employees_api_double).to receive(:
|
28
|
+
expect(stackone_employees_api_double).to receive(:hris_employees_get).with('456', '123', { :expand => 'employments,home_location' })
|
29
29
|
|
30
30
|
subject.employees_list('123', options)
|
31
31
|
end
|
@@ -34,11 +34,11 @@ describe MergeHRISClient::EmployeesApi do
|
|
34
34
|
context 'and the cursor param is in the options' do
|
35
35
|
it 'calls the method from the StackOne client to list employees with cursor param mapped to page' do
|
36
36
|
paginated_employees_double = double('StackOneHRIS::PaginatedEmployeeList', :data => nil, :next_page => nil)
|
37
|
-
stackone_employees_api_double = double('StackOneHRIS::EmployeesApi', :
|
37
|
+
stackone_employees_api_double = double('StackOneHRIS::EmployeesApi', :hris_employees_list => paginated_employees_double)
|
38
38
|
allow(StackOneHRIS::EmployeesApi).to receive(:new).and_return(stackone_employees_api_double)
|
39
39
|
options = { :cursor => 'page_cursor' }
|
40
40
|
|
41
|
-
expect(stackone_employees_api_double).to receive(:
|
41
|
+
expect(stackone_employees_api_double).to receive(:hris_employees_list).with('123', { :page => 'page_cursor' })
|
42
42
|
|
43
43
|
subject.employees_list('123', options)
|
44
44
|
end
|
@@ -10,17 +10,17 @@ describe StackOneMigration::EmployeesMapper do
|
|
10
10
|
:last_name => 'Harrington',
|
11
11
|
:display_name => 'Jean Harrington',
|
12
12
|
:name => 'Jean Marie Harrington',
|
13
|
-
:
|
13
|
+
:avatar_url => 'https://www.gravatar.com/avatar/0c1c0c1c0c1c0c1c0c1c0c1c0c1c0c1c?d=mm&s=200',
|
14
14
|
:personal_email => 'ija@egje.wf',
|
15
15
|
:work_email => 'kota@efpiphi.kw',
|
16
16
|
:personal_phone_number => '(715) 658-9486',
|
17
|
-
:gender => StackOneHRIS::GenderEnum.new(value: 'female', source_value: '
|
17
|
+
:gender => StackOneHRIS::GenderEnum.new(value: 'female', source_value: 'Female'),
|
18
18
|
:date_of_birth => '1990-01-01',
|
19
19
|
:start_date => '2018-01-01',
|
20
20
|
:manager_id => '417b5e62-e011-5e69-a906-0aefade9ded1',
|
21
|
-
:ethnicity => StackOneHRIS::EthnicityEnum.new(value: 'white', source_value: '
|
22
|
-
:marital_status => StackOneHRIS::MaritalStatusEnum.new(value: 'married', source_value: '
|
23
|
-
:employment_status => StackOneHRIS::EmploymentStatusEnum.new(value: 'terminated', source_value: '
|
21
|
+
:ethnicity => StackOneHRIS::EthnicityEnum.new(value: 'white', source_value: 'White'),
|
22
|
+
:marital_status => StackOneHRIS::MaritalStatusEnum.new(value: 'married', source_value: 'Married'),
|
23
|
+
:employment_status => StackOneHRIS::EmploymentStatusEnum.new(value: 'terminated', source_value: 'Terminated'),
|
24
24
|
:work_phone_number => '(456) 787-3508',
|
25
25
|
:job_title => 'Manager',
|
26
26
|
:department => 'Human Resources',
|
@@ -33,18 +33,18 @@ describe StackOneMigration::EmployeesMapper do
|
|
33
33
|
:state => "CA",
|
34
34
|
:zip_code => "94105",
|
35
35
|
:country => StackOneHRIS::CountryCodeEnum.new(value: 'US', source_value: 'United States'),
|
36
|
-
:location_type => StackOneHRIS::LocationTypeEnum.new(value: 'home', source_value: '
|
36
|
+
:location_type => StackOneHRIS::LocationTypeEnum.new(value: 'home', source_value: 'Home'),
|
37
37
|
),
|
38
38
|
:work_location => nil,
|
39
39
|
:employments => [
|
40
40
|
StackOneHRIS::Employment.new(
|
41
41
|
:job_title => 'Manager',
|
42
42
|
:pay_rate => 100000,
|
43
|
-
:pay_period => StackOneHRIS::PayPeriodEnum.new(value: 'year', source_value: '
|
44
|
-
:pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: '
|
43
|
+
:pay_period => StackOneHRIS::PayPeriodEnum.new(value: 'year', source_value: 'Year'),
|
44
|
+
:pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: 'Weekly'),
|
45
45
|
:pay_currency => 'USD',
|
46
46
|
:effective_date => '2018-01-01',
|
47
|
-
:employment_type => StackOneHRIS::EmploymentTypeEnum.new(value: 'full_time', source_value: '
|
47
|
+
:employment_type => StackOneHRIS::EmploymentTypeEnum.new(value: 'full_time', source_value: 'Full time'),
|
48
48
|
)
|
49
49
|
]
|
50
50
|
)
|
@@ -56,10 +56,9 @@ describe StackOneMigration::EmployeesMapper do
|
|
56
56
|
:last_name => 'Shaw',
|
57
57
|
:display_name => 'Allie Shaw',
|
58
58
|
:name => 'Allie Jennifer Shaw',
|
59
|
-
:avatar => StackOneHRIS::Image.new(base64: 'this_is_a_base64_string'),
|
60
59
|
:personal_email => 'ija@egje.wf',
|
61
60
|
:work_email => 'kota@efpiphi.kw',
|
62
|
-
:gender => StackOneHRIS::GenderEnum.new(value: 'female', source_value: '
|
61
|
+
:gender => StackOneHRIS::GenderEnum.new(value: 'female', source_value: 'Female'),
|
63
62
|
:date_of_birth => '1990-01-01',
|
64
63
|
:start_date => '2018-01-01',
|
65
64
|
:manager_id => '417b5e62-e011-5e69-a906-0aefade9ded1',
|
@@ -75,13 +74,10 @@ describe StackOneMigration::EmployeesMapper do
|
|
75
74
|
:last_name => 'Shaw',
|
76
75
|
:display_name => 'Allie Shaw',
|
77
76
|
:name => 'Allie Jennifer Shaw',
|
78
|
-
:
|
79
|
-
url: 'https://www.gravatar.com/avatar/0c1c0c1c0c1c0c1c0c1c0c1c0c1c0c1c?d=mm&s=200',
|
80
|
-
base64: 'this_is_a_base64_string'
|
81
|
-
),
|
77
|
+
:avatar_url => 'https://www.gravatar.com/avatar/0c1c0c1c0c1c0c1c0c1c0c1c0c1c0c1c?d=mm&s=200',
|
82
78
|
:personal_email => 'ija@egje.wf',
|
83
79
|
:work_email => 'kota@efpiphi.kw',
|
84
|
-
:gender => StackOneHRIS::GenderEnum.new(value: 'female', source_value: '
|
80
|
+
:gender => StackOneHRIS::GenderEnum.new(value: 'female', source_value: 'Female'),
|
85
81
|
:date_of_birth => '1990-01-01',
|
86
82
|
:start_date => '2018-01-01',
|
87
83
|
:manager_id => '417b5e62-e011-5e69-a906-0aefade9ded1',
|
@@ -99,7 +95,7 @@ describe StackOneMigration::EmployeesMapper do
|
|
99
95
|
:name => 'Allie Jennifer Shaw',
|
100
96
|
:personal_email => 'ija@egje.wf',
|
101
97
|
:work_email => 'kota@efpiphi.kw',
|
102
|
-
:gender => StackOneHRIS::GenderEnum.new(value: 'female', source_value: '
|
98
|
+
:gender => StackOneHRIS::GenderEnum.new(value: 'female', source_value: 'Female'),
|
103
99
|
:date_of_birth => '1990-01-01',
|
104
100
|
:start_date => '2018-01-01',
|
105
101
|
:manager_id => '417b5e62-e011-5e69-a906-0aefade9ded1',
|
@@ -134,10 +130,10 @@ describe StackOneMigration::EmployeesMapper do
|
|
134
130
|
:work_location => nil,
|
135
131
|
:company => nil,
|
136
132
|
)
|
137
|
-
expect(target_model.gender).to have_attributes(:value => 'FEMALE')
|
138
|
-
expect(target_model.ethnicity).to have_attributes(:value => 'WHITE')
|
139
|
-
expect(target_model.marital_status).to have_attributes(:value => 'MARRIED_FILING_JOINTLY')
|
140
|
-
expect(target_model.employment_status).to have_attributes(:value => 'INACTIVE')
|
133
|
+
expect(target_model.gender).to have_attributes(:value => 'FEMALE', :raw_value => 'Female')
|
134
|
+
expect(target_model.ethnicity).to have_attributes(:value => 'WHITE', :raw_value => 'White')
|
135
|
+
expect(target_model.marital_status).to have_attributes(:value => 'MARRIED_FILING_JOINTLY', :raw_value => 'Married')
|
136
|
+
expect(target_model.employment_status).to have_attributes(:value => 'INACTIVE', :raw_value => 'Terminated')
|
141
137
|
end
|
142
138
|
|
143
139
|
context 'when the employee record has the avatar base64 field instead of url' do
|
@@ -233,7 +229,7 @@ describe StackOneMigration::EmployeesMapper do
|
|
233
229
|
:state => "CA",
|
234
230
|
:zip_code => "94105",
|
235
231
|
:country => StackOneHRIS::CountryCodeEnum.new(value: 'US', source_value: 'United States'),
|
236
|
-
:location_type => StackOneHRIS::LocationTypeEnum.new(value: 'home', source_value: '
|
232
|
+
:location_type => StackOneHRIS::LocationTypeEnum.new(value: 'home', source_value: 'Home'),
|
237
233
|
)
|
238
234
|
|
239
235
|
target_model = described_class.map_to_location_model(sample_location)
|
@@ -247,8 +243,29 @@ describe StackOneMigration::EmployeesMapper do
|
|
247
243
|
expect(target_model.city).to eq("San Francisco")
|
248
244
|
expect(target_model.state).to eq("CA")
|
249
245
|
expect(target_model.zip_code).to eq("94105")
|
250
|
-
expect(target_model.country).to have_attributes(:value => 'US')
|
251
|
-
expect(target_model.location_type).to have_attributes(:value => 'HOME')
|
246
|
+
expect(target_model.country).to have_attributes(:value => 'US', :raw_value => 'United States')
|
247
|
+
expect(target_model.location_type).to have_attributes(:value => 'HOME', :raw_value => 'Home')
|
248
|
+
end
|
249
|
+
|
250
|
+
context 'when the city is null' do
|
251
|
+
it 'maps a location with the city field set to the name' do
|
252
|
+
sample_location = StackOneHRIS::Location.new(
|
253
|
+
:id => '123',
|
254
|
+
:name => 'Location Name',
|
255
|
+
:phone_number => "(456) 787-3508",
|
256
|
+
:street_1 => "123 Main' St",
|
257
|
+
:street_2 => "Apt 1",
|
258
|
+
:city => nil,
|
259
|
+
:state => "CA",
|
260
|
+
:zip_code => "94105",
|
261
|
+
:country => StackOneHRIS::CountryCodeEnum.new(value: 'US', source_value: 'United States'),
|
262
|
+
:location_type => StackOneHRIS::LocationTypeEnum.new(value: 'home', source_value: 'Home'),
|
263
|
+
)
|
264
|
+
|
265
|
+
target_model = described_class.map_to_location_model(sample_location)
|
266
|
+
|
267
|
+
expect(target_model.city).to eq("Location Name")
|
268
|
+
end
|
252
269
|
end
|
253
270
|
end
|
254
271
|
|
@@ -266,7 +283,7 @@ describe StackOneMigration::EmployeesMapper do
|
|
266
283
|
|
267
284
|
target_model = described_class.map_country_enum(sample_country)
|
268
285
|
|
269
|
-
expect(target_model).to have_attributes(:value => 'US', :raw_value => '
|
286
|
+
expect(target_model).to have_attributes(:value => 'US', :raw_value => 'United States')
|
270
287
|
end
|
271
288
|
|
272
289
|
context 'when the original enum is an unmapped value' do
|
@@ -285,11 +302,11 @@ describe StackOneMigration::EmployeesMapper do
|
|
285
302
|
sample_employment = StackOneHRIS::Employment.new(
|
286
303
|
:job_title => 'Manager',
|
287
304
|
:pay_rate => 100000,
|
288
|
-
:pay_period => StackOneHRIS::PayPeriodEnum.new(value: 'year', source_value: '
|
289
|
-
:pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: '
|
305
|
+
:pay_period => StackOneHRIS::PayPeriodEnum.new(value: 'year', source_value: 'Year'),
|
306
|
+
:pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: 'Weekly'),
|
290
307
|
:pay_currency => 'USD',
|
291
308
|
:effective_date => '2018-01-01',
|
292
|
-
:employment_type => StackOneHRIS::EmploymentTypeEnum.new(value: 'full_time', source_value: '
|
309
|
+
:employment_type => StackOneHRIS::EmploymentTypeEnum.new(value: 'full_time', source_value: 'Full time'),
|
293
310
|
)
|
294
311
|
|
295
312
|
target_model = described_class.map_to_employment_model(sample_employment)
|
@@ -301,22 +318,22 @@ describe StackOneMigration::EmployeesMapper do
|
|
301
318
|
sample_employment = StackOneHRIS::Employment.new(
|
302
319
|
:job_title => 'Manager',
|
303
320
|
:pay_rate => 100000,
|
304
|
-
:pay_period => StackOneHRIS::PayPeriodEnum.new(value: 'year', source_value: '
|
305
|
-
:pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: '
|
321
|
+
:pay_period => StackOneHRIS::PayPeriodEnum.new(value: 'year', source_value: 'Year'),
|
322
|
+
:pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: 'Weekly'),
|
306
323
|
:pay_currency => 'USD',
|
307
324
|
:effective_date => '2018-01-01',
|
308
|
-
:employment_type => StackOneHRIS::EmploymentTypeEnum.new(value: 'full_time', source_value: '
|
325
|
+
:employment_type => StackOneHRIS::EmploymentTypeEnum.new(value: 'full_time', source_value: 'Full time'),
|
309
326
|
)
|
310
327
|
|
311
328
|
target_model = described_class.map_to_employment_model(sample_employment)
|
312
329
|
|
313
330
|
expect(target_model.job_title).to eq('Manager')
|
314
331
|
expect(target_model.pay_rate).to eq(100000)
|
315
|
-
expect(target_model.pay_period).to have_attributes(:value => 'YEAR')
|
316
|
-
expect(target_model.pay_frequency).to have_attributes(:value => 'WEEKLY')
|
317
|
-
expect(target_model.pay_currency).to have_attributes(:value => 'USD')
|
332
|
+
expect(target_model.pay_period).to have_attributes(:value => 'YEAR', :raw_value => 'Year')
|
333
|
+
expect(target_model.pay_frequency).to have_attributes(:value => 'WEEKLY', :raw_value => 'Weekly')
|
334
|
+
expect(target_model.pay_currency).to have_attributes(:value => 'USD', :raw_value => 'USD')
|
318
335
|
expect(target_model.effective_date).to eq('2018-01-01')
|
319
|
-
expect(target_model.employment_type).to have_attributes(:value => 'FULL_TIME')
|
336
|
+
expect(target_model.employment_type).to have_attributes(:value => 'FULL_TIME', :raw_value => 'Full time')
|
320
337
|
end
|
321
338
|
end
|
322
339
|
|
@@ -394,7 +411,7 @@ describe StackOneMigration::EmployeesMapper do
|
|
394
411
|
it 'returns the mapped enum' do
|
395
412
|
target_value = described_class.map_enum(
|
396
413
|
described_class.pay_period_enum_hash,
|
397
|
-
StackOneHRIS::PayPeriodEnum.new(value: 'year', source_value: '
|
414
|
+
StackOneHRIS::PayPeriodEnum.new(value: 'year', source_value: 'Year')
|
398
415
|
)
|
399
416
|
|
400
417
|
expect(target_value).to eq('YEAR')
|
@@ -415,7 +432,7 @@ describe StackOneMigration::EmployeesMapper do
|
|
415
432
|
it 'returns nil' do
|
416
433
|
target_value = described_class.map_enum(
|
417
434
|
described_class.pay_period_enum_hash,
|
418
|
-
StackOneHRIS::PayPeriodEnum.new(value: nil, source_value: '
|
435
|
+
StackOneHRIS::PayPeriodEnum.new(value: nil, source_value: 'Year')
|
419
436
|
)
|
420
437
|
|
421
438
|
expect(target_value).to be_nil
|
data/stackone_migration.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.required_ruby_version = '>= 2.7'
|
17
17
|
|
18
18
|
s.add_runtime_dependency 'merge_hris_client', '~> 3.0'
|
19
|
-
s.add_runtime_dependency 'stackone_hris_client', '~> 1.
|
19
|
+
s.add_runtime_dependency 'stackone_hris_client', '~> 1.6.0'
|
20
20
|
|
21
21
|
s.add_development_dependency 'rspec', '~> 3.6', '>= 3.6.0'
|
22
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackone_migration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- StackOne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: merge_hris_client
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.6.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.6.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|