forest_liana 9.4.0 → 9.4.1

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: 855ec9302b2f8b3c54c16efb2919b9324c22feecaa132a02075914478ae3b040
4
- data.tar.gz: eb8275f28303c3b76a95460854037be8f619a8fa74541a91dd80128fb3e49457
3
+ metadata.gz: 724523bd71eba9f8a1db607e12b2ce1a54e5a431859b54e4d0f46c3c42aa9482
4
+ data.tar.gz: 88d830ea88004bb6d4ad8d66b0cc348cf7372ba51bb521f02e50dac94e272a46
5
5
  SHA512:
6
- metadata.gz: 7e140338ed979e85df67414887d3fc986b0eb58abe88649dcdc140b565f43b5e72f788d3952213e3c82ff5057b23b5c63bd3543be7279f534f77893efc3b1179
7
- data.tar.gz: ec56a023d16948a3a21736b43ae89f3ab0cf5a9bec456b2a34d90299ceefdf9b0e0d9809d938e40f88e8bae30d7ce96cc63f8334ab0124bd95943d730e3aa999
6
+ metadata.gz: 2a2f77f63b02b3646e1c700abc568923f4d70fb8e5c1604a56e6c81839da39bafe48d8060b3535e8f7306de6c401ef7f757c7c6758fe827aa8ae95d202cbee01
7
+ data.tar.gz: 14e4423bf077e7e74a5021f133f3488baac0dd09fb1682df7757dded9d863b52a3757f0c6aafa3547c3acb3c351c172d30807b7b045cc5d4135e2252b7612379
@@ -29,8 +29,9 @@ module ForestLiana
29
29
  end
30
30
 
31
31
  if context_variable_key.start_with?(USER_VALUE_TAG_PREFIX)
32
+ tag_key = context_variable_key[USER_VALUE_TAG_PREFIX.length..]
32
33
  user['tags'].each do |tag|
33
- return tag[context_variable_key[USER_VALUE_TAG_PREFIX.length..]] if tag.key?(context_variable_key[USER_VALUE_TAG_PREFIX.length..])
34
+ return tag['value'] if tag['key'] == tag_key
34
35
  end
35
36
  end
36
37
 
@@ -1,3 +1,3 @@
1
1
  module ForestLiana
2
- VERSION = "9.4.0"
2
+ VERSION = "9.4.1"
3
3
  end
@@ -10,7 +10,7 @@ module ForestLiana
10
10
  'lastName' => 'Doe',
11
11
  'fullName' => 'John Doe',
12
12
  'email' => 'john.doe@domain.com',
13
- 'tags' => [{ 'planet' => 'Death Star' }],
13
+ 'tags' => [{'key' => 'planet', 'value' => 'Death Star' }],
14
14
  'roleId' => 1,
15
15
  'permissionLevel' => 'admin'
16
16
  }
@@ -87,7 +87,7 @@ module ForestLiana
87
87
  { key: 'id', expected_value: user['id'] },
88
88
  { key: 'permissionLevel', expected_value: user['permissionLevel'] },
89
89
  { key: 'roleId', expected_value: user['roleId'] },
90
- { key: 'tags.planet', expected_value: user['tags'][0]['planet'] },
90
+ { key: 'tags.planet', expected_value: user['tags'][0]['value'] },
91
91
  { key: 'team.id', expected_value: team['id'] },
92
92
  { key: 'team.name', expected_value: team['name'] }
93
93
  ].each do |value|
@@ -35,9 +35,24 @@ module ForestLiana
35
35
  it 'returns the corresponding value from the key provided of the user data' do
36
36
  context_variables = described_class.new(team, user, request_context_variables)
37
37
  expect(context_variables.get_value('currentUser.first_name')).to eq('John')
38
- expect(context_variables.get_value('currentUser.tags.key')).to eq('tag1')
38
+ expect(context_variables.get_value('currentUser.tags.tag1')).to eq('value1')
39
39
  expect(context_variables.get_value('currentUser.team.id')).to eq(1)
40
40
  end
41
+
42
+ it 'returns nil when the user key does not exist' do
43
+ context_variables = described_class.new(team, user, request_context_variables)
44
+ expect(context_variables.get_value('currentUser.non_existent_key')).to eq(nil)
45
+ end
46
+
47
+ it 'returns nil when the tag key does not exist' do
48
+ context_variables = described_class.new(team, user, request_context_variables)
49
+ expect(context_variables.get_value('currentUser.tags.non_existent_tag')).to eq(nil)
50
+ end
51
+
52
+ it 'returns nil when the request context variable key does not exist' do
53
+ context_variables = described_class.new(team, user, request_context_variables)
54
+ expect(context_variables.get_value('non_existent_key')).to eq(nil)
55
+ end
41
56
  end
42
57
  end
43
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.4.0
4
+ version: 9.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-17 00:00:00.000000000 Z
11
+ date: 2024-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails