stackone_migration 1.4.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12f55eba7877d4d7d35e0001c386bfb990fb341df546ef503e96bacf0ea3f452
4
- data.tar.gz: 35628efb66506a70f4e812994f83d7ba846ba9f25dc25f9a44db9486dd6c2e6c
3
+ metadata.gz: b6813d14400fc237d5f222a228470bdbd2e8977d5ca735a6f3b16d2bdc7608e6
4
+ data.tar.gz: 3b75ed197dce2a96019ffe121c4a438047d5aec85d45dbe97f2e7c767b1002d3
5
5
  SHA512:
6
- metadata.gz: fb4b210b5afdd18c2bd965660307ba57e8c1b36affe6d154bd48b68cedfca10bd4f2ace68a7c22fb9a05b7ade2a74badf91e35cec8395fc3833a2620f0f1cc6c
7
- data.tar.gz: 868f0f74f6ad9070ce8c2ca8634340947271398d9a23f286c0a620a1faa06a37fcae7cda6fcd6679dabad0a4ba321f59f39ff799bf0303f7ade94431f3d6d861
6
+ metadata.gz: 35249c393424ad0d863ad36c13a48d5d05570d4ce48c5b1b7ff2a4cfe84eb6210761b5c55eaff40d910fec9649776653aa2c13a3819ad2e3990ace79e41892d1
7
+ data.tar.gz: d4eeebe7d72a8faa739f2461816f687e2516b24b22f872ceed2b69047c76339614c69efec1122232bed5b532f54b4d4bead70413f5a77c9ed91120aecac3b9a6
data/Gemfile CHANGED
@@ -11,4 +11,4 @@ group :development, :test do
11
11
  end
12
12
 
13
13
  gem 'merge_hris_client', '~> 3.0'
14
- gem 'stackone_hris_client', '~> 1.5.2'
14
+ gem 'stackone_hris_client', '~> 1.6.0'
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stackone_migration (1.4.3)
4
+ stackone_migration (1.4.5)
5
5
  merge_hris_client (~> 3.0)
6
- stackone_hris_client (~> 1.5.2)
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.5.2)
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.5.2)
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.employees_get(opts[:remote_id], x_account_id,
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.employees_list(x_account_id, opts)
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
@@ -10,7 +10,7 @@ module MergeHRISClient
10
10
  connect_session_create_request = StackOneHRIS::ConnectSessionCreate.new(
11
11
  :origin_owner_id => end_user_details_request.end_user_origin_id,
12
12
  :origin_owner_name => end_user_details_request.end_user_email_address,
13
- :provider => end_user_details_request.integration,
13
+ :provider => StackOneMigration::ProviderMapper.map_to_stackone_provider_name(end_user_details_request.integration),
14
14
  :categories => end_user_details_request.categories,
15
15
  )
16
16
 
@@ -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.avatar&.url,
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.build_from_hash(map_enum(gender_enum_hash, employee.gender)),
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.build_from_hash(map_enum(ethnicity_enum_hash, employee.ethnicity)),
109
- :marital_status => MergeHRISClient::MaritalStatusEnum.build_from_hash(map_enum(marital_status_enum_hash, employee.marital_status)),
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.build_from_hash(map_enum(employment_status_enum_hash, employee.employment_status)),
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.build_from_hash(map_enum(location_type_enum_hash, location.location_type)),
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.build_from_hash(map_enum(pay_period_enum_hash, employment.pay_period)),
144
- :pay_frequency => MergeHRISClient::PayFrequencyEnum.build_from_hash(map_enum(pay_frequency_enum_hash, employment.pay_frequency)),
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.build_from_hash(map_enum(employment_type_enum_hash, employment.employment_type)),
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
@@ -0,0 +1,25 @@
1
+ module StackOneMigration
2
+ class ProviderMapper
3
+ def self.provider_name_hash
4
+ {
5
+ :hibob => 'hibob',
6
+ :workday => 'workday',
7
+ :bamboohr => 'bamboohr',
8
+ :'ukg-ready' => 'ukgready',
9
+ :'ukg-pro' => 'ukgpro',
10
+ :'sage-hr' => 'sage',
11
+ :'adp-workforce-now' => 'adpworkforcenow',
12
+ :'sap-successfactors' => 'sapsuccessfactors',
13
+ }
14
+ end
15
+
16
+ def self.map_to_stackone_provider_name(provider_name)
17
+ return nil if provider_name.nil?
18
+
19
+ mapped_provider_name = provider_name_hash[provider_name.to_sym]
20
+ return mapped_provider_name unless mapped_provider_name.nil?
21
+
22
+ provider_name
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StackOneMigration
4
- VERSION = '1.4.3'
4
+ VERSION = '1.4.5'
5
5
  end
@@ -14,6 +14,7 @@ require 'stackone_migration/api/link_token_api'
14
14
 
15
15
  # Mappers
16
16
  require 'stackone_migration/mappers/employees_mapper'
17
+ require 'stackone_migration/mappers/provider_mapper'
17
18
 
18
19
  # Helpers
19
20
  require 'stackone_migration/helpers/account_helper'
@@ -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', :employees_list => paginated_employees_double)
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(:employees_list).with('123', options)
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', :employees_get => paginated_employees_double)
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(:employees_get).with('456', '123', { :expand => 'employments,home_location' })
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', :employees_list => paginated_employees_double)
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(:employees_list).with('123', { :page => 'page_cursor' })
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
@@ -50,13 +50,13 @@ describe MergeHRISClient::LinkTokenApi do
50
50
  :end_user_email_address => 'tos@potig.er',
51
51
  :end_user_origin_id => 'user_origin_id',
52
52
  :categories => ['hris'],
53
- :integration => 'stackone_hris_provider',
53
+ :integration => 'sage-hr',
54
54
  )
55
55
 
56
56
  expected_request = StackOneHRIS::ConnectSessionCreate.new(
57
57
  :origin_owner_id => 'user_origin_id',
58
58
  :origin_owner_name => 'tos@potig.er',
59
- :provider => 'stackone_hris_provider',
59
+ :provider => 'sage',
60
60
  :categories => ['hris'],
61
61
  )
62
62
 
@@ -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
- :avatar => StackOneHRIS::Image.new(url: 'https://www.gravatar.com/avatar/0c1c0c1c0c1c0c1c0c1c0c1c0c1c0c1c?d=mm&s=200'),
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: 'female'),
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: 'white'),
22
- :marital_status => StackOneHRIS::MaritalStatusEnum.new(value: 'married', source_value: 'married'),
23
- :employment_status => StackOneHRIS::EmploymentStatusEnum.new(value: 'terminated', source_value: 'terminated'),
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: 'home'),
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: 'year'),
44
- :pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: 'weekly'),
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: 'full_time'),
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: 'female'),
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
- :avatar => StackOneHRIS::Image.new(
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: 'female'),
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: 'female'),
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: 'home'),
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 => 'US')
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: 'year'),
289
- :pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: 'weekly'),
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: 'full_time'),
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: 'year'),
305
- :pay_frequency => StackOneHRIS::PayFrequencyEnum.new(value: 'weekly', source_value: 'weekly'),
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: 'full_time'),
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: 'year')
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: 'year')
435
+ StackOneHRIS::PayPeriodEnum.new(value: nil, source_value: 'Year')
419
436
  )
420
437
 
421
438
  expect(target_value).to be_nil
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe StackOneMigration::ProviderMapper do
6
+ context '.map_to_stackone_provider_name' do
7
+ it 'returns the mapped provider name' do
8
+ actual_provider = described_class.map_to_stackone_provider_name('hibob')
9
+
10
+ expect(actual_provider).to eq('hibob')
11
+ end
12
+
13
+ it 'returns the mapped provider name' do
14
+ actual_provider = described_class.map_to_stackone_provider_name('ukg-pro')
15
+
16
+ expect(actual_provider).to eq('ukgpro')
17
+ end
18
+
19
+ context 'when the provider name is nil' do
20
+ it 'returns nil' do
21
+ actual_provider = described_class.map_to_stackone_provider_name(nil)
22
+
23
+ expect(actual_provider).to be_nil
24
+ end
25
+ end
26
+
27
+ context 'when the provider name could not be mapped' do
28
+ it 'returns the original provider name' do
29
+ actual_provider = described_class.map_to_stackone_provider_name('ashby-ats')
30
+
31
+ expect(actual_provider).to eq('ashby-ats')
32
+ end
33
+ end
34
+ end
35
+ end
@@ -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.5.2'
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.3
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-05-18 00:00:00.000000000 Z
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.5.2
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.5.2
40
+ version: 1.6.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -77,6 +77,7 @@ files:
77
77
  - lib/stackone_migration/api/link_token_api.rb
78
78
  - lib/stackone_migration/helpers/account_helper.rb
79
79
  - lib/stackone_migration/mappers/employees_mapper.rb
80
+ - lib/stackone_migration/mappers/provider_mapper.rb
80
81
  - lib/stackone_migration/version.rb
81
82
  - spec/api/account_token_api_spec.rb
82
83
  - spec/api/delete_account_api_spec.rb
@@ -84,6 +85,7 @@ files:
84
85
  - spec/api/link_token_api_spec.rb
85
86
  - spec/helpers/account_helper_spec.rb
86
87
  - spec/mappers/employees_mapper_spec.rb
88
+ - spec/mappers/provider_mapper_spec.rb
87
89
  - spec/spec_helper.rb
88
90
  - stackone_migration.gemspec
89
91
  homepage: https://stackone.com
@@ -116,4 +118,5 @@ test_files:
116
118
  - spec/api/link_token_api_spec.rb
117
119
  - spec/helpers/account_helper_spec.rb
118
120
  - spec/mappers/employees_mapper_spec.rb
121
+ - spec/mappers/provider_mapper_spec.rb
119
122
  - spec/spec_helper.rb