stackone_migration 1.3.0 → 1.4.0

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: daa32597a9e8c833693f8b94f572af6fee65310b673ede6e67a99f6772ee0d87
4
- data.tar.gz: fc23f733389cce570bb07754170e84f59d7f065f6b69931e8ddb941b25002fad
3
+ metadata.gz: 67a03369917c2e312bf393a5f96d3493d5b6430647fc8f080d3b2a37be59c29a
4
+ data.tar.gz: ac3404c9425e9a1bddbf0613025bfaa84e1091e6afc5b137dc12f4eaa1cdfd18
5
5
  SHA512:
6
- metadata.gz: 149a32da85baab2c457cda99adb372a5bdb520927f8f28768f1c9a365a9cd878d9817029313f710f4e908ad49860db43ec9ec17f981ecf0d259664a52ea40124
7
- data.tar.gz: 1598674e96bb4bd3724e087382cc5ad53c183c83ad3826d7d224ca56c0764d0da49b3f1f13bb46ff3d96112acdf108a8f10960ba434deb0d4ca958d19ce44421
6
+ metadata.gz: 603295af5e304db4088764640a04a6c5d61a5cb0f569d66aec876732b49c659e6054eaa7b870c511d244a244dc7f47b194e8c20440c22cc1bd9e18792c0f59ed
7
+ data.tar.gz: 1e766c8704c8ab85cdb04607819dced4e65b6516c550c322975bb95de60cd6bc20e7419d013389158466b8353ed1f87f391f180567a87fdfe70839975196dfec
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.4.0'
14
+ gem 'stackone_hris_client', '~> 1.5.1'
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stackone_migration (1.3.0)
4
+ stackone_migration (1.4.0)
5
5
  merge_hris_client (~> 3.0)
6
- stackone_hris_client (~> 1.4.0)
6
+ stackone_hris_client (~> 1.5.1)
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.4.0)
61
+ stackone_hris_client (1.5.1)
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.4.0)
76
+ stackone_hris_client (~> 1.5.1)
77
77
  stackone_migration!
78
78
 
79
79
  BUNDLED WITH
@@ -129,7 +129,7 @@ module StackOneMigration
129
129
  :city => location.city,
130
130
  :state => location.state,
131
131
  :zip_code => location.zip_code,
132
- :country => MergeHRISClient::CountryEnum.build_from_hash(location.country),
132
+ :country => map_country_enum(location.country),
133
133
  :location_type => MergeHRISClient::LocationTypeEnum.build_from_hash(map_enum(location_type_enum_hash, location.location_type)),
134
134
  )
135
135
  end
@@ -196,5 +196,13 @@ module StackOneMigration
196
196
 
197
197
  enum.source_value
198
198
  end
199
+
200
+ def self.map_country_enum(enum)
201
+ return nil if enum.nil? || enum.value.nil?
202
+
203
+ enum_value = enum.value != 'unmapped_value' ? enum.value : enum.source_value
204
+
205
+ MergeHRISClient::CountryEnum.build_from_hash(enum_value)
206
+ end
199
207
  end
200
208
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StackOneMigration
4
- VERSION = '1.3.0'
4
+ VERSION = '1.4.0'
5
5
  end
@@ -32,7 +32,7 @@ describe StackOneMigration::EmployeesMapper do
32
32
  :city => "San Francisco",
33
33
  :state => "CA",
34
34
  :zip_code => "94105",
35
- :country => "US",
35
+ :country => StackOneHRIS::CountryCodeEnum.new(value: 'US', source_value: 'United States'),
36
36
  :location_type => StackOneHRIS::LocationTypeEnum.new(value: 'home', source_value: 'home'),
37
37
  ),
38
38
  :work_location => nil,
@@ -120,7 +120,7 @@ describe StackOneMigration::EmployeesMapper do
120
120
  :city => "San Francisco",
121
121
  :state => "CA",
122
122
  :zip_code => "94105",
123
- :country => "US"
123
+ :country => StackOneHRIS::CountryCodeEnum.new(value: 'US', source_value: 'United States'),
124
124
  )
125
125
 
126
126
  target_model = described_class.map_to_location_model(sample_location)
@@ -138,7 +138,7 @@ describe StackOneMigration::EmployeesMapper do
138
138
  :city => "San Francisco",
139
139
  :state => "CA",
140
140
  :zip_code => "94105",
141
- :country => "US",
141
+ :country => StackOneHRIS::CountryCodeEnum.new(value: 'US', source_value: 'United States'),
142
142
  :location_type => StackOneHRIS::LocationTypeEnum.new(value: 'home', source_value: 'home'),
143
143
  )
144
144
 
@@ -153,11 +153,39 @@ describe StackOneMigration::EmployeesMapper do
153
153
  expect(target_model.city).to eq("San Francisco")
154
154
  expect(target_model.state).to eq("CA")
155
155
  expect(target_model.zip_code).to eq("94105")
156
- expect(target_model.country).to have_attributes(:raw_value => 'US')
156
+ expect(target_model.country).to have_attributes(:value => 'US')
157
157
  expect(target_model.location_type).to have_attributes(:value => 'HOME')
158
158
  end
159
159
  end
160
160
 
161
+ context '.map_country_enum' do
162
+ it 'maps a country to correct class' do
163
+ sample_country = StackOneHRIS::CountryCodeEnum.new(value: 'US', source_value: 'United States')
164
+
165
+ target_model = described_class.map_country_enum(sample_country)
166
+
167
+ expect(target_model).to be_a(MergeHRISClient::CountryEnum)
168
+ end
169
+
170
+ it 'maps to a country with the right attributes' do
171
+ sample_country = StackOneHRIS::CountryCodeEnum.new(value: 'US', source_value: 'United States')
172
+
173
+ target_model = described_class.map_country_enum(sample_country)
174
+
175
+ expect(target_model).to have_attributes(:value => 'US', :raw_value => 'US')
176
+ end
177
+
178
+ context 'when the original enum is an unmapped value' do
179
+ it 'maps to a country with non standard value' do
180
+ sample_country = StackOneHRIS::CountryCodeEnum.new(value: 'unmapped_value', source_value: 'United States')
181
+
182
+ target_model = described_class.map_country_enum(sample_country)
183
+
184
+ expect(target_model).to have_attributes(:value => 'MERGE_NONSTANDARD_VALUE', :raw_value => 'United States')
185
+ end
186
+ end
187
+ end
188
+
161
189
  context '.map_to_employment_model' do
162
190
  it 'maps a employeement to correct class' do
163
191
  sample_employment = StackOneHRIS::Employment.new(
@@ -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.4.0'
19
+ s.add_runtime_dependency 'stackone_hris_client', '~> 1.5.1'
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.3.0
4
+ version: 1.4.0
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-04 00:00:00.000000000 Z
11
+ date: 2023-05-09 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.4.0
33
+ version: 1.5.1
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.4.0
40
+ version: 1.5.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement