wolf_core 0.1.34 → 0.1.36

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: 64bf85e637237faf906bf3495efcc05d8c2be7295b2ff64c20c87464420f8df5
4
- data.tar.gz: 5a99f9ed1838b481b7179c3a49bfd2c531b97be001e65c26bff9a0793f6ebff7
3
+ metadata.gz: 05fe2d492ce2f8260270eee75659448aad2bb510b6a4099b2067fa346e3f3e61
4
+ data.tar.gz: f233b5c12098def0614fee840da78b64cd6cf271460a46b2a8ba1973ef0c16db
5
5
  SHA512:
6
- metadata.gz: 79a2d5c004a5602e94aa31b3f12c369f2968f06596681e6f54a05318f8d3c730c2a75d2be4dd29ed5741cb94e302f60eefdf7551e2a2ef48348506c44313656a
7
- data.tar.gz: 3640fe26ecd15c32e4a0d88773f3017618b900c614837ba26cc604a5e5c55e728f0a7dd2fc7a317e9e8461280069dec9b632d0e5100aa757992fa01c77b34dfb
6
+ metadata.gz: 6662eff1ac373047c599f190888d65bfb42baa726d540ac59890b8f4eaadbfdaee184e3b7bfff35715c54f3ee6e180e26abc4e5e558f67264f3dc68320615cb8
7
+ data.tar.gz: '0918137298ac2c0cdaf98e4f5ccee3ae443006413e26a88f94e0021852fdb1a5dad5c6267c70b3cafb34e06942873a49ac28dabc336a382379f5c3e90f63dfb4'
@@ -1,6 +1,7 @@
1
1
  module WolfCore
2
2
  module FkmOperations
3
3
  include WolfCore::HttpOperations
4
+ include WolfCore::LoggingUtils
4
5
 
5
6
  def get_foreign_key_destination_id(tenant:, source:, source_id:, destination:)
6
7
  foreign_keys = get_foreign_keys(tenant: tenant, source: source, source_id: source_id)
@@ -12,10 +13,22 @@ module WolfCore
12
13
  response = http_get(
13
14
  url: "#{ENV['FKM_URL']}/Prod/lookup?tenant=#{tenant}&source=#{source}&source_id=#{source_id}"
14
15
  )
15
- puts 'foreign keys response is'
16
- pp response
16
+ response = parse_http_response(response)
17
+ log_object 'get_foreign_keys response is'
18
+ log_object response
17
19
  validate_http_response(response: response, message: 'Error getting foreign keys')
18
- parse_http_response(response).body
20
+ response.body
21
+ end
22
+
23
+ def get_foreign_keys_by_destination(tenant:, destination:, destination_id:)
24
+ response = http_get(
25
+ url: "#{ENV['FKM_URL']}/Prod/lookup?tenant=#{tenant}&destination=#{destination}&destination_id=#{destination_id}"
26
+ )
27
+ response = parse_http_response(response)
28
+ log_object 'get_foreign_keys_by_destination response is'
29
+ log_object response
30
+ validate_http_response(response: response, message: 'Error getting foreign keys by destination id')
31
+ response.body
19
32
  end
20
33
 
21
34
  def create_foreign_key(tenant:, source:, source_id:, destination:, destination_id:)
@@ -29,8 +42,9 @@ module WolfCore
29
42
  destination_id: destination_id
30
43
  }
31
44
  )
32
- puts 'create foreign key response is'
33
- pp response
45
+ response = parse_http_response(response)
46
+ log_object 'create_foreign_key response is'
47
+ log_object response
34
48
  validate_http_response(response: response, message: 'Error creating foreign key')
35
49
  parse_http_response(response).body
36
50
  end
@@ -2,10 +2,10 @@ module WolfCore
2
2
  module LoggingUtils
3
3
  def log_object(object)
4
4
  case object
5
- when Hash, OpenStruct
5
+ when Hash, Array, OpenStruct
6
6
  object = object.to_h if object.instance_of?(OpenStruct)
7
7
  puts object.to_json
8
- when Array, Object
8
+ when Object
9
9
  pp object
10
10
  else
11
11
  puts object
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "0.1.34"
4
+ VERSION = "0.1.36"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolf_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.34
4
+ version: 0.1.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo