wolf_core 0.1.7 → 0.1.9
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c517a3ae1e9a7976aacd1c55c2b5a4afc63a2d6477e3a7981b95daf258ffa356
|
4
|
+
data.tar.gz: c1864554bc9678a831dd7afd07034bcc3a8a4c35581cdb32796f7194f7ee1acd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d03d683ff36488bba061d8b1edfde209b6f2b856d863d01aa1b365cd24a404cb5eeebf162f03016c6319fd96780cc2fa6d1a3f6ee5f92ab389424a7a3f277b6b
|
7
|
+
data.tar.gz: 1949e3b711310c8ad506af966f226532d12bd2d103bf79420c443e303847b8d9dc23ccf0afd829a91c2356a06855c73166f65fad80f692183e9e76d8282ebbc0
|
@@ -3,19 +3,49 @@ module WolfCore
|
|
3
3
|
include WolfCore::HttpOperations
|
4
4
|
|
5
5
|
def get_foreign_key_destination_id(tenant:, source:, source_id:, destination:)
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
foreign_keys = get_foreign_keys(tenant: tenant, source: source, source_id: source_id)
|
7
|
+
foreign_key = foreign_keys.find { |fk| fk['destination'] == destination }
|
8
|
+
foreign_key&.dig('destination_id')
|
9
9
|
end
|
10
10
|
|
11
11
|
def get_foreign_keys(tenant:, source:, source_id:)
|
12
12
|
response = http_get(
|
13
13
|
url: "#{ENV['FKM_URL']}/Prod/lookup?tenant=#{tenant}&source=#{source}&source_id=#{source_id}"
|
14
14
|
)
|
15
|
-
puts 'foreign keys response is'
|
16
|
-
pp response
|
15
|
+
# puts 'foreign keys response is'
|
16
|
+
# pp response
|
17
17
|
validate_http_response(response: response, message: 'Error getting foreign keys')
|
18
18
|
parse_http_response(response).body
|
19
19
|
end
|
20
|
+
|
21
|
+
def create_foreign_key(tenant:, source:, source_id:, destination:, destination_id:)
|
22
|
+
response = http_post(
|
23
|
+
url: "#{ENV['FKM_URL']}/Prod/create",
|
24
|
+
body: {
|
25
|
+
tenant: tenant,
|
26
|
+
source: source,
|
27
|
+
source_id: source_id,
|
28
|
+
destination: destination,
|
29
|
+
destination_id: destination_id
|
30
|
+
}
|
31
|
+
)
|
32
|
+
# puts 'create foreign key response is'
|
33
|
+
# pp response
|
34
|
+
validate_http_response(response: response, message: 'Error creating foreign key')
|
35
|
+
parse_http_response(response).body
|
36
|
+
end
|
37
|
+
|
38
|
+
# def find_or_create_foreign_key(tenant:, source:, source_id:, destination:, destination_id:)
|
39
|
+
# destination_id = get_foreign_key_destination_id(
|
40
|
+
# tenant: tenant, source: source, source_id: source_id,
|
41
|
+
# destination: destination
|
42
|
+
# )
|
43
|
+
# return Result.success(data: { operation: :find }) if destination_id.present?
|
44
|
+
# create_foreign_key(
|
45
|
+
# tenant: tenant, source: source, source_id: source_id,
|
46
|
+
# destination: destination, destination_id: destination_id
|
47
|
+
# )
|
48
|
+
# Result.success(data: { operation: :create })
|
49
|
+
# end
|
20
50
|
end
|
21
51
|
end
|
data/lib/wolf_core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wolf_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Javier Roncallo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|