wolf_core 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wolf_core/application/fkm_operations.rb +33 -3
- data/lib/wolf_core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 528a60641dfb2e5ebbef08b651c0bc1cdfa1cf331f8363dc3891b55d123ee0c5
|
4
|
+
data.tar.gz: 16cfdf72aacaa1392589e86a2192bbca45461db381059a27668b1e6c4467ed9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6a6ed0cfbe69cfefbb9bb052c291444d2179e89c5dc75dbe78c86493f984048e6667397d3e033781f4ccaf01c7b76263add88baaed4400e437cc07b65727ec0
|
7
|
+
data.tar.gz: 34c7af4cdf39488b6ba043a02a78bcaf598e1d835f892b82aed39fbb283746d187f496983d08904b6decccd1c80c22aaa8b327b3c4489c3eb01b55e09e2852e0
|
@@ -3,9 +3,9 @@ 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:)
|
@@ -17,5 +17,35 @@ module WolfCore
|
|
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.8
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|