wolf_core 1.0.78 → 1.0.80

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: 3cdf821478350d9768fad37e18e71dcfd64ffded145ead6b2a645ea76fadb35a
4
- data.tar.gz: f177d7981e5a4408cee5050604502d8f96889a66bb139e035de3e9482e17297e
3
+ metadata.gz: dba5a6af48f4e65eb2177ce9efbe3054962b0ae0a9486c6e6bebf56e807e504b
4
+ data.tar.gz: a1e4b6de1374970c33cd412815538304ba4c055a7c56ac397372c574a41b68e5
5
5
  SHA512:
6
- metadata.gz: b45bf02cc38386e06bd132b02131328832cc0abad5d92ea24fe93de0f02d130964d94bf28b9edf3935b7dcec37cd5c12a31f16cf4f3c48602a82c8be8932ab1c
7
- data.tar.gz: 391da00769556cf83144db1b53a139a6b9c5bd10ac8ba27ab24b4f8f6cbe47084e04501d8dac5f9ee2c98f5c538d159bceaa5e6a347b7bff8a00a2970c66b0e8
6
+ metadata.gz: b95aa6e078393c421bd80c5181f492937663a854e10193578a0cc7c01d77993fb4f0274fdd2b651c3dfecf6375e0eda52e699e1f9666884ab216d9402844ee3c
7
+ data.tar.gz: d13fd447223299bbf6e2ed7198175c937c37cd47204bd5bfb96169903856a29314e1dd21b7bcb963cc77b08e52d637d44f91d3951d876b17c7c23af803b37f35
@@ -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,40 +131,43 @@ 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
- def upsert_custom_value(wolf_token:, tenant:, wolf_platform_url:, query:, custom_requirement_id:, custom_value:, error_message:, error_data: nil)
138
+ def upsert_custom_value(wolf_token:, tenant:, wolf_platform_url:, query:, custom_requirement_id:, custom_value:)
135
139
  response = fetch_custom_values(
136
140
  wolf_token: wolf_token,
137
141
  tenant: tenant,
138
142
  wolf_platform_url: wolf_platform_url,
139
143
  query: query
140
144
  )
141
-
145
+
142
146
  return response unless response_success?(response)
143
-
147
+
144
148
  custom_values = response.body.dig("data", "table", "custom_values")
145
-
146
- if custom_values&.any?
149
+
150
+ response = if custom_values&.any?
151
+ operation_type = :update
147
152
  custom_value_id = custom_values.first["id"]
148
- update_response = update_custom_value(
153
+ update_custom_value(
149
154
  wolf_platform_url: wolf_platform_url,
150
155
  tenant: tenant,
151
156
  wolf_token: wolf_token,
152
157
  custom_value_id: custom_value_id,
153
- custom_value: custom_value,
154
- query: query
158
+ custom_value: custom_value
155
159
  )
156
160
  else
157
- create_response = create_custom_value(
161
+ operation_type = :create
162
+ create_custom_value(
158
163
  wolf_platform_url: wolf_platform_url,
159
164
  tenant: tenant,
160
165
  wolf_token: wolf_token,
161
166
  custom_requirement_id: custom_requirement_id,
162
- custom_value: custom_value,
163
- query: query
167
+ custom_value: custom_value
164
168
  )
165
169
  end
170
+ OpenStruct.new({ operation_type: operation_type, response: response })
166
171
  end
167
172
  end
168
173
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WolfCore
4
- VERSION = "1.0.78"
4
+ VERSION = "1.0.80"
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: 1.0.78
4
+ version: 1.0.80
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Roncallo