stackone_migration 1.6.2 → 1.6.3

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: d469fc2eff7c4b06d225e138492292a27da80bc2f0ab93c42511cfa9fc924c29
4
- data.tar.gz: 7e3be5dc88259fc2a4697e42864de61f183b3f3b52c79c6d838b833806a6538e
3
+ metadata.gz: 94018a5c8bea5ac5c7db380a17afebbc5f36df51451e57d824ff9bc2af442428
4
+ data.tar.gz: c45de2c354412532fc373bfb2580b8036c6b6c0bbcd548f27c7aaacc0593d0c3
5
5
  SHA512:
6
- metadata.gz: de7e8d0d7e97eb08b10190488fee1373e068779e9ba6127da89e98c23c5f0b29acbb306e07e8fb02b06c2555afd38dd4cc86d885b380dc798f93ad95dc15b876
7
- data.tar.gz: 6277fb542b87337161bcb14460fbbf99ef225a774d93347fa88eff946e77d0c687f92056cc053cb0e01407c264afca2569d7c124028e194d82c96c1baf9153be
6
+ metadata.gz: a55b0e72717e64ed97253ae72fbbfd0a95a23ab5ef557aebbcb2da66557ee5acb8adac6adef0bf490712c2d196d2edc9a1966a6e98a94a6ef964bedb378173d0
7
+ data.tar.gz: 7cb666974fb605e967dc30695db41faa99381555915846e1a391dc09c08da4e6e9524640e6fd37dd1f30368100157609c11e040c7b959e186e7329180afdadfb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stackone_migration (1.6.2)
4
+ stackone_migration (1.6.3)
5
5
  merge_hris_client (= 3.2.0)
6
6
  stackone_hris_client (~> 1.7.1)
7
7
 
@@ -8,8 +8,9 @@ module MergeHRISClient
8
8
  return original_account_token_retrieve(public_token, opts) unless StackOneMigration::AccountHelper.stackone_account?(public_token)
9
9
 
10
10
  account_data = StackOneHRIS::AccountsApi.new.accounts_get(public_token)
11
-
12
- integration_data = MergeHRISClient::AccountIntegration.new(slug: account_data.provider)
11
+
12
+ merge_provider_name = StackOneMigration::ProviderMapper.map_to_merge_provider_name(account_data.provider)
13
+ integration_data = MergeHRISClient::AccountIntegration.new(slug: merge_provider_name)
13
14
  MergeHRISClient::AccountToken.new(account_token: public_token, integration: integration_data)
14
15
 
15
16
  rescue StackOneHRIS::ApiError
@@ -21,5 +21,14 @@ module StackOneMigration
21
21
 
22
22
  provider_name
23
23
  end
24
+
25
+ def self.map_to_merge_provider_name(provider_name)
26
+ return nil if provider_name.nil?
27
+
28
+ mapped_provider_name = provider_name_hash.key(provider_name)&.to_s
29
+ return mapped_provider_name unless mapped_provider_name.nil?
30
+
31
+ provider_name
32
+ end
24
33
  end
25
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StackOneMigration
4
- VERSION = '1.6.2'
4
+ VERSION = '1.6.3'
5
5
  end
@@ -18,13 +18,13 @@ describe MergeHRISClient::AccountTokenApi do
18
18
  end
19
19
 
20
20
  it 'returns an account token object with the right attributes' do
21
- account_data = StackOneHRIS::Account.new(:id => '12345', :provider => 'stackone_hris_provider')
21
+ account_data = StackOneHRIS::Account.new(:id => '12345', :provider => 'adpworkforcenow')
22
22
  stackone_account_api_double = double('StackOneHRIS::AccountsApi', :accounts_get => account_data)
23
23
  allow(StackOneHRIS::AccountsApi).to receive(:new).and_return(stackone_account_api_double)
24
24
 
25
25
  result = subject.account_token_retrieve('12345')
26
26
 
27
- expect(result).to have_attributes(:account_token => '12345', :integration => MergeHRISClient::AccountIntegration.new(:slug => 'stackone_hris_provider'))
27
+ expect(result).to have_attributes(:account_token => '12345', :integration => MergeHRISClient::AccountIntegration.new(:slug => 'adp-workforce-now'))
28
28
  end
29
29
  end
30
30
  end
@@ -32,4 +32,34 @@ describe StackOneMigration::ProviderMapper do
32
32
  end
33
33
  end
34
34
  end
35
+
36
+ context '.map_to_merge_provider_name' do
37
+ it 'returns the mapped provider name' do
38
+ actual_provider = described_class.map_to_merge_provider_name('hibob')
39
+
40
+ expect(actual_provider).to eq('hibob')
41
+ end
42
+
43
+ it 'returns the mapped provider name' do
44
+ actual_provider = described_class.map_to_merge_provider_name('ukgpro')
45
+
46
+ expect(actual_provider).to eq('ukg-pro')
47
+ end
48
+
49
+ context 'when the provider name is nil' do
50
+ it 'returns nil' do
51
+ actual_provider = described_class.map_to_merge_provider_name(nil)
52
+
53
+ expect(actual_provider).to be_nil
54
+ end
55
+ end
56
+
57
+ context 'when the provider name could not be mapped' do
58
+ it 'returns the original provider name' do
59
+ actual_provider = described_class.map_to_merge_provider_name('ashby-ats')
60
+
61
+ expect(actual_provider).to eq('ashby-ats')
62
+ end
63
+ end
64
+ end
35
65
  end
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.6.2
4
+ version: 1.6.3
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-16 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: merge_hris_client