wolf_core 1.0.75 → 1.0.77

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: 6f011c478a70508946b4aa16f10d6749c842aea485027bd7b8a2fde9ccc43d5a
4
- data.tar.gz: 3bc5fd12423ffefd6e92e67c4b37c59780a2e007eac3515ab7de900742c6a3d4
3
+ metadata.gz: 78299938906476e29c333da5adb6b67feca648350340bdde8aa3934d03a7f744
4
+ data.tar.gz: 49428fc05ee308e5b6e4f8421f9e98975f5648561182cc22b2987356b75b03c5
5
5
  SHA512:
6
- metadata.gz: f5e3344e597806c180b75aec1ddfdb2498ad3fec63161d873bce3c2803c63b3071084de99ab78f109afe72f0744d4425973816edadadbd3e27cdcea5b76db449
7
- data.tar.gz: 817abf1f440b17c81aa850621c2aebfc8f126bed0960904656ce83f751005117cab516a41313aa185f678d7c659d225ebf820a6c59123f55895b74a77d6ec11c
6
+ metadata.gz: 1a6db374f67ce4c6ed4847ebac8b333d6dc1d9e44b14d8c67980694beacdf9bdafe2f4b796f648ece803241195a09c5a723f870f6ad87917ddb97057a9da1e2f
7
+ data.tar.gz: 1c81b0487da6230c39896c8eb6393ee817e3e9587e97c026056ec4afd804ec4e118a408dec3806d008f9d69f5e3db00a98ebb58b2f8ee5fa467956e681cb5134
@@ -0,0 +1,135 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WolfCore
4
+ module Integrations
5
+ module CustomValueApiOperations
6
+ include WolfCore::HttpOperations
7
+
8
+ def fetch_custom_values!(wolf_token:, tenant:, wolf_platform_url:, error_message:, error_data: nil, query: nil)
9
+ response = fetch_custom_values(
10
+ wolf_token: wolf_token,
11
+ tenant: tenant,
12
+ wolf_platform_url: wolf_platform_url,
13
+ query: query
14
+ )
15
+ validate_http_response(response: response, message: error_message, error_data: error_data)
16
+ response.body.dig("data", "table", "custom_values")
17
+ end
18
+
19
+ def fetch_custom_values(wolf_token:, tenant:, wolf_platform_url:, query: nil)
20
+ query ||= {}
21
+ parsed_http_get(
22
+ headers: { "Authorization" => "Bearer #{wolf_token}" },
23
+ url: "#{wolf_platform_url}/api/v2/custom_values",
24
+ query: query.merge(tenant: tenant)
25
+ )
26
+ end
27
+
28
+ def fetch_custom_value!(wolf_token:, custom_value_id:, tenant:, wolf_platform_url:, error_message:,
29
+ error_data: nil, query: nil)
30
+ response = fetch_custom_value(
31
+ wolf_token: wolf_token,
32
+ custom_value_id: custom_value_id,
33
+ tenant: tenant,
34
+ wolf_platform_url: wolf_platform_url,
35
+ query: query
36
+ )
37
+ validate_http_response(response: response, message: error_message, error_data: error_data)
38
+ response.body.dig("data", "table", "custom_value")
39
+ end
40
+
41
+ def fetch_custom_value(wolf_token:, custom_value_id:, tenant:, wolf_platform_url:, query: nil)
42
+ query ||= {}
43
+ parsed_http_get(
44
+ headers: { "Authorization" => "Bearer #{wolf_token}" },
45
+ url: "#{wolf_platform_url}/api/v2/custom_values/#{custom_value_id}",
46
+ query: query.merge(tenant: tenant)
47
+ )
48
+ end
49
+
50
+ def create_custom_value!(wolf_token:, custom_value:, tenant:, wolf_platform_url:, error_message:,
51
+ custom_requirement_id:, error_data: nil, query: nil)
52
+ response = create_custom_value(
53
+ wolf_token: wolf_token,
54
+ custom_value: custom_value,
55
+ tenant: tenant,
56
+ wolf_platform_url: wolf_platform_url,
57
+ custom_requirement_id: custom_requirement_id,
58
+ query: query
59
+ )
60
+ validate_http_response(response: response, message: error_message, error_data: error_data)
61
+ response
62
+ end
63
+
64
+ def create_custom_value(wolf_token:, custom_value:, tenant:, wolf_platform_url:, custom_requirement_id:,
65
+ query: nil)
66
+ query ||= {}
67
+ parsed_http_post(
68
+ headers: { "Authorization" => "Bearer #{wolf_token}" },
69
+ query: query.merge(tenant: tenant),
70
+ url: "#{wolf_platform_url}/api/v2/custom_requirements/#{custom_requirement_id}/custom_values",
71
+ body: custom_value
72
+ )
73
+ end
74
+
75
+ def update_custom_value!(wolf_token:, custom_value:, tenant:, wolf_platform_url:, error_message:,
76
+ custom_value_id:, error_data: nil, query: nil)
77
+ response = update_custom_value(
78
+ wolf_token: wolf_token,
79
+ custom_value: custom_value,
80
+ tenant: tenant,
81
+ wolf_platform_url: wolf_platform_url,
82
+ custom_value_id: custom_value_id,
83
+ query: query
84
+ )
85
+ validate_http_response(response: response, message: error_message, error_data: error_data)
86
+ response
87
+ end
88
+
89
+ def update_custom_value(wolf_token:, custom_value:, tenant:, wolf_platform_url:, custom_value_id:, query: nil)
90
+ query ||= {}
91
+ parsed_http_put(
92
+ headers: { "Authorization" => "Bearer #{wolf_token}" },
93
+ query: query.merge(tenant: tenant),
94
+ url: "#{wolf_platform_url}/api/v2/custom_values/#{custom_value_id}",
95
+ body: custom_value
96
+ )
97
+ end
98
+
99
+ def upsert_custom_value!(wolf_token:, tenant:, wolf_platform_url:, query:, custom_requirement_id:, custom_value:,
100
+ error_message:, error_data: nil)
101
+ response = fetch_custom_values(
102
+ wolf_token: wolf_token,
103
+ tenant: tenant,
104
+ wolf_platform_url: wolf_platform_url,
105
+ query: query
106
+ )
107
+ validate_http_response(response: response, message: error_message, error_data: error_data)
108
+ custom_values = response.body.dig("data", "table", "custom_values")
109
+
110
+ if custom_values&.any?
111
+ custom_value_id = custom_values.first["id"]
112
+ update_custom_value!(
113
+ wolf_platform_url: wolf_platform_url,
114
+ tenant: tenant,
115
+ wolf_token: wolf_token,
116
+ custom_value_id: custom_value_id,
117
+ custom_value: custom_value,
118
+ error_message: error_message,
119
+ error_data: error_data
120
+ )
121
+ else
122
+ create_custom_value!(
123
+ wolf_platform_url: wolf_platform_url,
124
+ tenant: tenant,
125
+ wolf_token: wolf_token,
126
+ custom_requirement_id: custom_requirement_id,
127
+ custom_value: custom_value,
128
+ error_message: error_message,
129
+ error_data: error_data
130
+ )
131
+ end
132
+ end
133
+ end
134
+ end
135
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "1.0.75"
4
+ VERSION = "1.0.77"
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: 1.0.75
4
+ version: 1.0.77
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-30 00:00:00.000000000 Z
11
+ date: 2025-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -110,6 +110,7 @@ files:
110
110
  - lib/wolf_core/application/exception_operations.rb
111
111
  - lib/wolf_core/application/integrations/change_detection.rb
112
112
  - lib/wolf_core/application/integrations/client_api_operations.rb
113
+ - lib/wolf_core/application/integrations/custom_value_api_operations.rb
113
114
  - lib/wolf_core/application/integrations/environment_operations.rb
114
115
  - lib/wolf_core/application/integrations/iterate_orders_service.rb
115
116
  - lib/wolf_core/application/integrations/jobseeker_api_operations.rb