multiwoven-integrations 0.7.3 → 0.7.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28f2cee4355f4a7c3c902e63c472d66e0c9672e56eb8a7d3d59d6a1f30eb081b
|
4
|
+
data.tar.gz: 14826912ddd6788207ea9bd4973669770f4818566d9e647ad820ef9798366f16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd632aad01828e0b8b704682b4b1d0fd991dae8365234ed8dfd9f977c0189e768b924f084dc303370761fc0b4fc37ab63c29bc658cbd2de2af84125d8bd6abae
|
7
|
+
data.tar.gz: 070df0ba004365a1e1823085f093aab9814bf7034626da96d26659e3ae347766c07784ea711888e307397e0a7eb1bfc0bd4cb6ba9dcefa955232b77a1ab7749e
|
@@ -54,31 +54,35 @@ module Multiwoven
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def process_records(records, stream)
|
57
|
+
log_message_array = []
|
57
58
|
write_success = 0
|
58
59
|
write_failure = 0
|
59
60
|
records.each do |record_object|
|
60
61
|
record = extract_data(record_object, stream.json_schema[:properties])
|
61
|
-
response = process_stream(record, stream)
|
62
|
+
request, response = *process_stream(record, stream)
|
62
63
|
if response.success?
|
63
64
|
write_success += 1
|
64
65
|
else
|
65
66
|
write_failure += 1
|
66
67
|
end
|
68
|
+
log_message_array << log_request_response("info", request, response.body)
|
67
69
|
rescue StandardError => e
|
68
70
|
handle_exception("ITERABLE:WRITE:EXCEPTION", "error", e)
|
69
71
|
write_failure += 1
|
72
|
+
log_message_array << log_request_response("error", request, e.message)
|
70
73
|
end
|
71
|
-
tracking_message(write_success, write_failure)
|
74
|
+
tracking_message(write_success, write_failure, log_message_array)
|
72
75
|
end
|
73
76
|
|
74
77
|
def process_stream(record, stream)
|
75
78
|
klass = ::Iterable.const_get(stream.name).new(*initialize_params(stream, record))
|
76
79
|
item_attrs = initialize_attribute(stream, record)
|
77
|
-
if stream.name == "CatalogItems"
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
80
|
+
response = if stream.name == "CatalogItems"
|
81
|
+
klass.send("create", item_attrs)
|
82
|
+
else
|
83
|
+
klass.send("create")
|
84
|
+
end
|
85
|
+
[item_attrs, response]
|
82
86
|
end
|
83
87
|
|
84
88
|
def initialize_params(stream, record)
|
@@ -97,12 +101,6 @@ module Multiwoven
|
|
97
101
|
end
|
98
102
|
end
|
99
103
|
|
100
|
-
def tracking_message(success, failure)
|
101
|
-
Multiwoven::Integrations::Protocol::TrackingMessage.new(
|
102
|
-
success: success, failed: failure
|
103
|
-
).to_multiwoven_message
|
104
|
-
end
|
105
|
-
|
106
104
|
def load_catalog
|
107
105
|
read_json(CATALOG_SPEC_PATH)
|
108
106
|
end
|
@@ -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
|