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: 5ca9abe5598015be65bbd2cf6cb0808a4c7436b99df0c4f6b5e96d5f43dcccae
4
- data.tar.gz: ad9928ab5098aae5b4535ef7f8d5306a601c249a0c8330c2ff67fb39d9abf5e0
3
+ metadata.gz: c517a3ae1e9a7976aacd1c55c2b5a4afc63a2d6477e3a7981b95daf258ffa356
4
+ data.tar.gz: c1864554bc9678a831dd7afd07034bcc3a8a4c35581cdb32796f7194f7ee1acd
5
5
  SHA512:
6
- metadata.gz: 6c18f02be0fd828ac99ec164d2a048a88753f443eb27a79d54c81da48b56705ea3eecbb003e71861d72150671e8b4d5b7c8a85085de1335b28fa541fdb3f8d0b
7
- data.tar.gz: 89df7da8c9db30ccc5d72780f34847e3490ccd5dd5ac437086ad346a15163647566de0938d92fcaad2177cfb99c2c2f69be09c43466053cc419bd50e642d807a
6
+ metadata.gz: d03d683ff36488bba061d8b1edfde209b6f2b856d863d01aa1b365cd24a404cb5eeebf162f03016c6319fd96780cc2fa6d1a3f6ee5f92ab389424a7a3f277b6b
7
+ data.tar.gz: 1949e3b711310c8ad506af966f226532d12bd2d103bf79420c443e303847b8d9dc23ccf0afd829a91c2356a06855c73166f65fad80f692183e9e76d8282ebbc0
@@ -59,8 +59,8 @@ module WolfCore
59
59
  foreign_object = salesforce_http_get(
60
60
  query: { calltype: 'getRecord', RecordId: record_id }
61
61
  )
62
- puts "foreign object is"
63
- pp foreign_object
62
+ # puts "foreign object is"
63
+ # pp foreign_object
64
64
  foreign_object
65
65
  end
66
66
 
@@ -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
- 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:)
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
@@ -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.9"
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.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-09 00:00:00.000000000 Z
11
+ date: 2024-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty