multiwoven-integrations 0.7.2 → 0.7.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37b545ee313b4f088f5978fc8332e12506b2c964919a4a1a6599c7549c968ba0
|
4
|
+
data.tar.gz: b8a089e677f9726a7ef2b432a6b6334a5e40e96b3190c216a133b6eef5cb6a09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e1563c35fdf1db6451ce8c53231a2b7aba4a1eaf050d264817e3c4d63be2c46c30691b7b08007c74af76a4d91b01bcd256b370f4c2fefe6e23e617adf8e1f85
|
7
|
+
data.tar.gz: 9fbe9e662993a134224d1ee03aff8ec6124ce7f59cc545b4beb3efba98407bfa42a19a846b4ebdb8d0c9a80ef4e9a58e82a4cc20219cc959a19ff3f16a98f926
|
@@ -153,13 +153,15 @@ module Multiwoven
|
|
153
153
|
|
154
154
|
# Batch has a limit of sending 2MB data. So creating a chunk of records to meet that limit
|
155
155
|
def process_record_chunks(records, sync_config)
|
156
|
+
log_message_array = []
|
156
157
|
write_success = 0
|
157
158
|
write_failure = 0
|
158
159
|
|
159
160
|
records.each_slice(MAX_CHUNK_SIZE) do |chunk|
|
160
161
|
values = prepare_chunk_values(chunk, sync_config.stream)
|
161
|
-
update_sheet_values(values, sync_config.stream.name)
|
162
|
+
request, response = *update_sheet_values(values, sync_config.stream.name)
|
162
163
|
write_success += values.size
|
164
|
+
log_message_array << log_request_response("info", request, response)
|
163
165
|
rescue StandardError => e
|
164
166
|
handle_exception(e, {
|
165
167
|
context: "GOOGLE_SHEETS:RECORD:WRITE:EXCEPTION",
|
@@ -168,9 +170,9 @@ module Multiwoven
|
|
168
170
|
sync_run_id: sync_config.sync_run_id
|
169
171
|
})
|
170
172
|
write_failure += chunk.size
|
173
|
+
log_message_array << log_request_response("error", request, e.message)
|
171
174
|
end
|
172
|
-
|
173
|
-
tracking_message(write_success, write_failure)
|
175
|
+
tracking_message(write_success, write_failure, log_message_array)
|
174
176
|
end
|
175
177
|
|
176
178
|
# We need to format the data to adhere to google sheets API format. This converts the sync mapped data to 2D array format expected by google sheets API
|
@@ -199,19 +201,14 @@ module Multiwoven
|
|
199
201
|
)
|
200
202
|
|
201
203
|
# TODO: Remove & this is added for the test to pass we need
|
202
|
-
@client&.batch_update_values(@spreadsheet_id, batch_update_request)
|
204
|
+
response = @client&.batch_update_values(@spreadsheet_id, batch_update_request)
|
205
|
+
[batch_update_request, response]
|
203
206
|
end
|
204
207
|
|
205
208
|
def load_catalog
|
206
209
|
read_json(CATALOG_SPEC_PATH)
|
207
210
|
end
|
208
211
|
|
209
|
-
def tracking_message(success, failure)
|
210
|
-
Multiwoven::Integrations::Protocol::TrackingMessage.new(
|
211
|
-
success: success, failed: failure
|
212
|
-
).to_multiwoven_message
|
213
|
-
end
|
214
|
-
|
215
212
|
def delete_extra_sheets(sheet_ids)
|
216
213
|
# Leave one sheet intact as a spreadsheet must have at least one sheet.
|
217
214
|
# Delete all other sheets.
|
@@ -57,11 +57,13 @@ module Multiwoven
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def process_records(records, stream)
|
60
|
+
log_message_array = []
|
60
61
|
write_success = 0
|
61
62
|
write_failure = 0
|
62
63
|
records.each do |record_object|
|
63
|
-
process_record(stream, record_object.with_indifferent_access)
|
64
|
+
request, response = *process_record(stream, record_object.with_indifferent_access)
|
64
65
|
write_success += 1
|
66
|
+
log_message_array << log_request_response("info", request, response)
|
65
67
|
rescue StandardError => e
|
66
68
|
write_failure += 1
|
67
69
|
handle_exception(e, {
|
@@ -70,8 +72,9 @@ module Multiwoven
|
|
70
72
|
sync_id: @sync_config.sync_id,
|
71
73
|
sync_run_id: @sync_config.sync_run_id
|
72
74
|
})
|
75
|
+
log_message_array << log_request_response("error", request, e.message)
|
73
76
|
end
|
74
|
-
tracking_message(write_success, write_failure)
|
77
|
+
tracking_message(write_success, write_failure, log_message_array)
|
75
78
|
end
|
76
79
|
|
77
80
|
def process_record(stream, record)
|
@@ -80,7 +83,8 @@ module Multiwoven
|
|
80
83
|
|
81
84
|
def send_data_to_slack(stream_name, record = {})
|
82
85
|
args = build_args(stream_name, record)
|
83
|
-
@client.send(stream_name, **args)
|
86
|
+
response = @client.send(stream_name, **args)
|
87
|
+
[args, response]
|
84
88
|
end
|
85
89
|
|
86
90
|
def build_args(stream_name, record)
|
@@ -114,12 +118,6 @@ module Multiwoven
|
|
114
118
|
def load_catalog
|
115
119
|
read_json(CATALOG_SPEC_PATH)
|
116
120
|
end
|
117
|
-
|
118
|
-
def tracking_message(success, failure)
|
119
|
-
Multiwoven::Integrations::Protocol::TrackingMessage.new(
|
120
|
-
success: success, failed: failure
|
121
|
-
).to_multiwoven_message
|
122
|
-
end
|
123
121
|
end
|
124
122
|
end
|
125
123
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiwoven-integrations
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Subin T P
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|