multiwoven-integrations 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/multiwoven/integrations/core/constants.rb +1 -1
- 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 +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5328da16858cd290955a6b993a1ee19285490298eeab3573b8ad55b3dacf7258
|
4
|
+
data.tar.gz: ef061954be00b3a90b5927f33e2633b05267968036123e743d5e3438ab4b18fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a74373e13a6a7f25385e675f8bad255383bfb937f60cb5f78b11512f4bcce749fa15da8f3c63530feeb0edfb5594a6270e857bc0d8975396de09a69f2ee9463
|
7
|
+
data.tar.gz: a3262d0ab25b5c7bc3d69f2499068c7fee1a7116c3fe07b23db26177b00e2572e3b721383ed70d2ab9118bf3c144af1b89cb6ce2b2c37f9081a0a18df12e7db5
|
@@ -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"
|
@@ -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
|