multiwoven-integrations 0.8.2 → 0.8.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 +4 -4
- data/lib/multiwoven/integrations/core/constants.rb +1 -1
- data/lib/multiwoven/integrations/destination/hubspot/client.rb +7 -9
- data/lib/multiwoven/integrations/destination/microsoft_excel/client.rb +9 -5
- data/lib/multiwoven/integrations/destination/microsoft_excel/config/catalog.json +1 -1
- data/lib/multiwoven/integrations/rollout.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdbc8318433dfa2cce91c25e1f32719508862392853bf55bc53d6ae8e69053d9
|
4
|
+
data.tar.gz: a1015a21ff091fe9ad21dd1fb6fb4812b3e14de5a7ac8a3dcac85d6af87717aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac89988c3b671ba1c537ea4adb21fa44b479a6a13b68a7d83f1250bd60e7552a95054af7acdcff5c9c1b3f1e55247df217b1a440b71449b3f4b1fd69afa8eaac
|
7
|
+
data.tar.gz: 2fc03b10bb99d452939a4ddc3f60af052ba0e2fa5e95461b9bb4af9a60544535068ff220423a6e538f21f01f3754f752dc56039735e2787fae604dd14c87baae
|
@@ -40,7 +40,7 @@ module Multiwoven
|
|
40
40
|
MS_EXCEL_TABLE_ROW_WRITE_API = "https://graph.microsoft.com/v1.0/drives/%<drive_id>s/items/%<item_id>s/"\
|
41
41
|
"workbook/worksheets/%<sheet_name>s/tables/%<table_name>s/rows"
|
42
42
|
MS_EXCEL_TABLE_API = "https://graph.microsoft.com/v1.0/drives/%<drive_id>s/items/%<item_id>s/workbook/"\
|
43
|
-
"worksheets/
|
43
|
+
"worksheets/%<sheet_name>s/tables?$select=name"
|
44
44
|
MS_EXCEL_FILES_API = "https://graph.microsoft.com/v1.0/drives/%<drive_id>s/root/children"
|
45
45
|
MS_EXCEL_WORKSHEETS_API = "https://graph.microsoft.com/v1.0/drives/%<drive_id>s/items/%<item_id>s/"\
|
46
46
|
"workbook/worksheets"
|
@@ -55,13 +55,15 @@ module Multiwoven
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def process_records(records, stream)
|
58
|
+
log_message_array = []
|
58
59
|
write_success = 0
|
59
60
|
write_failure = 0
|
60
61
|
properties = stream.json_schema.with_indifferent_access[:properties]
|
61
62
|
records.each do |record_object|
|
62
63
|
record = extract_data(record_object, properties)
|
63
|
-
send_data_to_hubspot(stream.name, record)
|
64
|
+
request, response = *send_data_to_hubspot(stream.name, record)
|
64
65
|
write_success += 1
|
66
|
+
log_message_array << log_request_response("info", request, response)
|
65
67
|
rescue StandardError => e
|
66
68
|
handle_exception(e, {
|
67
69
|
context: "HUBSPOT:CRM:WRITE:EXCEPTION",
|
@@ -70,15 +72,17 @@ module Multiwoven
|
|
70
72
|
sync_run_id: @sync_config.sync_run_id
|
71
73
|
})
|
72
74
|
write_failure += 1
|
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 send_data_to_hubspot(stream_name, record = {})
|
78
81
|
args = build_args(@action, stream_name, record)
|
79
82
|
hubspot_stream = @client.crm.send(stream_name)
|
80
83
|
hubspot_data = { simple_public_object_input_for_create: args }
|
81
|
-
hubspot_stream.basic_api.send(@action, hubspot_data)
|
84
|
+
response = hubspot_stream.basic_api.send(@action, hubspot_data)
|
85
|
+
[args, response]
|
82
86
|
end
|
83
87
|
|
84
88
|
def build_args(action, stream_name, record)
|
@@ -108,12 +112,6 @@ module Multiwoven
|
|
108
112
|
read_json(CATALOG_SPEC_PATH)
|
109
113
|
end
|
110
114
|
|
111
|
-
def tracking_message(success, failure)
|
112
|
-
Multiwoven::Integrations::Protocol::TrackingMessage.new(
|
113
|
-
success: success, failed: failure
|
114
|
-
).to_multiwoven_message
|
115
|
-
end
|
116
|
-
|
117
115
|
def log_debug(message)
|
118
116
|
Multiwoven::Integrations::Service.logger.debug(message)
|
119
117
|
end
|
@@ -49,8 +49,7 @@ module Multiwoven::Integrations::Destination
|
|
49
49
|
excel_files = get_file(token, drive_id)
|
50
50
|
worksheet = excel_files.find { |file| file[:name] == file_name }
|
51
51
|
item_id = worksheet[:id]
|
52
|
-
|
53
|
-
table = get_table(token, drive_id, item_id)
|
52
|
+
table = get_table(token, drive_id, item_id, sheet_name)
|
54
53
|
write_url = format(MS_EXCEL_TABLE_ROW_WRITE_API, drive_id: drive_id, item_id: item_id, sheet_name: sheet_name,
|
55
54
|
table_name: table["name"])
|
56
55
|
payload = { values: records.map(&:values) }
|
@@ -69,8 +68,8 @@ module Multiwoven::Integrations::Destination
|
|
69
68
|
JSON.parse(response.body)["id"]
|
70
69
|
end
|
71
70
|
|
72
|
-
def get_table(token, drive_id, item_id)
|
73
|
-
table_url = format(MS_EXCEL_TABLE_API, drive_id: drive_id, item_id: item_id)
|
71
|
+
def get_table(token, drive_id, item_id, sheet_name)
|
72
|
+
table_url = format(MS_EXCEL_TABLE_API, drive_id: drive_id, item_id: item_id, sheet_name: sheet_name)
|
74
73
|
response = Multiwoven::Integrations::Core::HttpClient.request(
|
75
74
|
table_url,
|
76
75
|
HTTP_GET,
|
@@ -114,9 +113,14 @@ module Multiwoven::Integrations::Destination
|
|
114
113
|
headers: auth_headers(token)
|
115
114
|
)
|
116
115
|
sheets_data = JSON.parse(sheet_response.body)
|
116
|
+
column_names = if sheets_data.key?("error")
|
117
|
+
["Column A"]
|
118
|
+
else
|
119
|
+
sheets_data["values"].first
|
120
|
+
end
|
117
121
|
result << {
|
118
122
|
sheet_name: sheet_name,
|
119
|
-
column_names:
|
123
|
+
column_names: column_names
|
120
124
|
}
|
121
125
|
end
|
122
126
|
result
|
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.8.
|
4
|
+
version: 0.8.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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|