wolf_core 1.0.79 → 1.0.81

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: cc3e21eb1532a5bd8771602f7dd2232b90e4473c250b89a1622522611b296c9e
4
- data.tar.gz: 36059878bace0fe3f461ccb766b1a7ef82fe005fb2ba8d920dcfc6f9f3f9cd41
3
+ metadata.gz: d770b8b47501988698701c91ffa342324c6e43ec650c7178896f936b1a74883b
4
+ data.tar.gz: ddc19851ae98030c93550ee26e752ad96ca0c777c4cf1d229546a8f2baf6eb9e
5
5
  SHA512:
6
- metadata.gz: 95bbf884e9bdd6ecff49f31c0d13acfe7d83bff9b8f0b25197d3d59cadc3f47d6759dfbbb6a017093ff407136f4fd852286e565d52d2bc0553fdb38a96a5b4f7
7
- data.tar.gz: e30ba7b7e3a113e0646bd686d73da9bf463b2316d571841a538b31c31779fc8d1f8f5334b7dbdf94d4acd1c29df9223c4052920bd1ccb7348aac03b38763e05c
6
+ metadata.gz: db957a6364b802eba6b4cf5405ac42a101b68fd505e6abec8cb3034bc34aaf3079e92c3bdd507c48d74d55ca4465f99ffb23e2084b29c32989916f079e5eaf84
7
+ data.tar.gz: 57fc200f603d2c6b2e38d63d44f4fd60b9966ad6a3f86bbed52af7e436c4d297dae869ed486ca6ad3e381295be2ea95636cf33fc1691d17abd0ef044c4ca8a9c
@@ -2,6 +2,7 @@ module WolfCore
2
2
  module Integrations
3
3
  module ClientApiOperations
4
4
  include WolfCore::HttpOperations
5
+ include WolfCore::Integrations::CustomValueApiOperations
5
6
 
6
7
  def fetch_client!(wolf_token:, client_id:, tenant:, wolf_platform_url:, error_message:)
7
8
  response = safe_http_get(
@@ -59,6 +60,24 @@ module WolfCore
59
60
  body: client
60
61
  )
61
62
  end
63
+
64
+ def fetch_client_custom_value!(wolf_token:, tenant:, wolf_platform_url:, client_id:, id: nil, custom_requirement_id: nil, query: nil, error_data: nil)
65
+ id || custom_requirement_id || raise_service_error({ message: "custom_requirement_id or id must be provided" })
66
+ query = {
67
+ user_category: 'Company',
68
+ user_code: client_id,
69
+ id: id,
70
+ custom_requirement_friendly_id: custom_requirement_id
71
+ }.compact.merge(query || {})
72
+ fetch_custom_values!(
73
+ wolf_token: wolf_token,
74
+ tenant: tenant,
75
+ wolf_platform_url: wolf_platform_url,
76
+ error_message: "Unable to fetch custom values for #{client_id}",
77
+ error_data: query.merge(error_data || {}),
78
+ query: query
79
+ ).first
80
+ end
62
81
  end
63
82
  end
64
83
  end
@@ -107,7 +107,8 @@ module WolfCore
107
107
  validate_http_response(response: response, message: error_message, error_data: error_data)
108
108
  custom_values = response.body.dig("data", "table", "custom_values")
109
109
 
110
- if custom_values&.any?
110
+ response = if custom_values&.any?
111
+ operation_type = :update
111
112
  custom_value_id = custom_values.first["id"]
112
113
  update_custom_value!(
113
114
  wolf_platform_url: wolf_platform_url,
@@ -119,6 +120,7 @@ module WolfCore
119
120
  error_data: error_data
120
121
  )
121
122
  else
123
+ operation_type = :create
122
124
  create_custom_value!(
123
125
  wolf_platform_url: wolf_platform_url,
124
126
  tenant: tenant,
@@ -129,6 +131,8 @@ module WolfCore
129
131
  error_data: error_data
130
132
  )
131
133
  end
134
+
135
+ { operation_type: operation_type, response: response }
132
136
  end
133
137
 
134
138
  def upsert_custom_value(wolf_token:, tenant:, wolf_platform_url:, query:, custom_requirement_id:, custom_value:)
@@ -143,7 +147,8 @@ module WolfCore
143
147
 
144
148
  custom_values = response.body.dig("data", "table", "custom_values")
145
149
 
146
- if custom_values&.any?
150
+ response = if custom_values&.any?
151
+ operation_type = :update
147
152
  custom_value_id = custom_values.first["id"]
148
153
  update_custom_value(
149
154
  wolf_platform_url: wolf_platform_url,
@@ -153,6 +158,7 @@ module WolfCore
153
158
  custom_value: custom_value
154
159
  )
155
160
  else
161
+ operation_type = :create
156
162
  create_custom_value(
157
163
  wolf_platform_url: wolf_platform_url,
158
164
  tenant: tenant,
@@ -161,6 +167,7 @@ module WolfCore
161
167
  custom_value: custom_value
162
168
  )
163
169
  end
170
+ OpenStruct.new({ operation_type: operation_type, response: response })
164
171
  end
165
172
  end
166
173
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "1.0.79"
4
+ VERSION = "1.0.81"
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.79
4
+ version: 1.0.81
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-31 00:00:00.000000000 Z
11
+ date: 2025-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty