air_test 0.1.5.4 → 0.1.5.5
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/air_test/notion_parser.rb +34 -2
- data/lib/air_test/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: e8814b0e5adb17e2636d7da5b58d8c2f472c78fa31325d1d415ef30de9993104
|
4
|
+
data.tar.gz: d1e48aa3bb971eaecb093b97a247197e4138b02ed5d9cb41c00d3f202c22afcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e2fee67f17bb43db86a10d981f73d033429ce2da0d55481eb56356c1fe979777cccf72e59e6a24fc79e3468cc681f12081c8ec9fa125394b2ae35ff8e00cf7b
|
7
|
+
data.tar.gz: 65138b6b62ad47c68fb0abc70ca9670687fd0d595c7de55b4e8e7a1817f54e8e17cc1159bfcdc34b3394f2bf125c670c42faaab3b360c868e496b96d51408999
|
@@ -26,9 +26,16 @@ module AirTest
|
|
26
26
|
|
27
27
|
def parse_ticket_content(page_id)
|
28
28
|
blocks = get_page_content(page_id)
|
29
|
+
puts "\n===== RAW NOTION BLOCKS ====="
|
30
|
+
puts JSON.pretty_generate(blocks)
|
29
31
|
return nil unless blocks
|
30
|
-
|
31
|
-
|
32
|
+
normalized_blocks = normalize_blocks(blocks)
|
33
|
+
puts "\n===== NORMALIZED BLOCKS ====="
|
34
|
+
puts JSON.pretty_generate(normalized_blocks)
|
35
|
+
parsed_data = parse_content(normalized_blocks)
|
36
|
+
puts "\n===== PARSED DATA ====="
|
37
|
+
puts JSON.pretty_generate(parsed_data)
|
38
|
+
parsed_data
|
32
39
|
end
|
33
40
|
|
34
41
|
def extract_ticket_title(ticket)
|
@@ -220,6 +227,31 @@ module AirTest
|
|
220
227
|
""
|
221
228
|
end
|
222
229
|
end
|
230
|
+
|
231
|
+
# Normalize Notion blocks: split multi-line blocks into one-line synthetic paragraph blocks
|
232
|
+
def normalize_blocks(blocks)
|
233
|
+
normalized = []
|
234
|
+
blocks.each do |block|
|
235
|
+
block_type = block["type"]
|
236
|
+
text = if block[block_type] && block[block_type]["rich_text"]
|
237
|
+
block[block_type]["rich_text"].map { |rt| rt["plain_text"] }.join("")
|
238
|
+
else
|
239
|
+
""
|
240
|
+
end
|
241
|
+
lines = text.split("\n").map(&:strip).reject(&:empty?)
|
242
|
+
if lines.size > 1
|
243
|
+
lines.each do |line|
|
244
|
+
normalized << {
|
245
|
+
"type" => "paragraph",
|
246
|
+
"paragraph" => { "rich_text" => [{ "plain_text" => line }] }
|
247
|
+
}
|
248
|
+
end
|
249
|
+
else
|
250
|
+
normalized << block
|
251
|
+
end
|
252
|
+
end
|
253
|
+
normalized
|
254
|
+
end
|
223
255
|
end
|
224
256
|
end
|
225
257
|
|
data/lib/air_test/version.rb
CHANGED