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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ca9abe5598015be65bbd2cf6cb0808a4c7436b99df0c4f6b5e96d5f43dcccae
4
- data.tar.gz: ad9928ab5098aae5b4535ef7f8d5306a601c249a0c8330c2ff67fb39d9abf5e0
3
+ metadata.gz: 528a60641dfb2e5ebbef08b651c0bc1cdfa1cf331f8363dc3891b55d123ee0c5
4
+ data.tar.gz: 16cfdf72aacaa1392589e86a2192bbca45461db381059a27668b1e6c4467ed9d
5
5
  SHA512:
6
- metadata.gz: 6c18f02be0fd828ac99ec164d2a048a88753f443eb27a79d54c81da48b56705ea3eecbb003e71861d72150671e8b4d5b7c8a85085de1335b28fa541fdb3f8d0b
7
- data.tar.gz: 89df7da8c9db30ccc5d72780f34847e3490ccd5dd5ac437086ad346a15163647566de0938d92fcaad2177cfb99c2c2f69be09c43466053cc419bd50e642d807a
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
- response_body = get_foreign_keys(tenant: tenant, source: source, source_id: source_id)
7
- foreign_keys = response_body
8
- foreign_keys.find { |fk| fk['destination'] == destination }&.dig('destination_id')
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.8"
5
5
  end
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.7
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-09 00:00:00.000000000 Z
11
+ date: 2024-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty