quarantine 2.1.0 → 2.1.1
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/quarantine/databases/google_sheets.rb +8 -5
- data/lib/quarantine/version.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: 3c4a41e99736f29fd49d864c842b1ecb87ac0fe514bd887176b97f13d49761cd
|
4
|
+
data.tar.gz: f36d408661b7cce88e7d4cffd0a6214ad937f452479bd8e706cdbcd03ee3d9f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c06c78fa1741d68ebfbc1c3a88b02d30391465f532f4a4597e3625b4379924ed0852518b1d11c79ae09b0248396a579b26fce8b9cc03a8c6203bb71513c56055
|
7
|
+
data.tar.gz: 61cc08f36624613bd9a1250926216b7ea60b3847ab505881974b710035a76c22a43159e3a7735a1360d59f4f31ada5cd99c3da9eb99338bca66e5432a1726f2b
|
@@ -35,7 +35,8 @@ class Quarantine
|
|
35
35
|
new_rows = []
|
36
36
|
|
37
37
|
# Map existing ID to row index
|
38
|
-
|
38
|
+
parsed_rows = parse_rows(worksheet)
|
39
|
+
indexes = Hash[parsed_rows.each_with_index.map { |item, idx| [item['id'], idx] }]
|
39
40
|
|
40
41
|
items.each do |item|
|
41
42
|
cells = headers.map { |header| item[header].to_s }
|
@@ -51,7 +52,7 @@ class Quarantine
|
|
51
52
|
end
|
52
53
|
|
53
54
|
# Insert any items whose IDs weren't found in existing rows at the end
|
54
|
-
worksheet.insert_rows(
|
55
|
+
worksheet.insert_rows(parsed_rows.count + 2, new_rows)
|
55
56
|
worksheet.save
|
56
57
|
end
|
57
58
|
|
@@ -98,9 +99,11 @@ class Quarantine
|
|
98
99
|
rows.map do |row|
|
99
100
|
hash_row = Hash[headers.zip(row)]
|
100
101
|
# TODO: use Google Sheets developer metadata to store type information
|
101
|
-
hash_row['
|
102
|
-
|
103
|
-
|
102
|
+
unless hash_row['id'].empty?
|
103
|
+
hash_row['extra_attributes'] = JSON.parse(hash_row['extra_attributes']) if hash_row['extra_attributes']
|
104
|
+
hash_row
|
105
|
+
end
|
106
|
+
end.compact
|
104
107
|
end
|
105
108
|
end
|
106
109
|
end
|
data/lib/quarantine/version.rb
CHANGED