From 7935069d44859d582cd1582b9278ecd9deea78f6 Mon Sep 17 00:00:00 2001 From: Nicole Wong Date: Thu, 22 Jul 2021 14:56:06 +0900 Subject: [PATCH] use 'title' to retrieve title instead of first key --- lib/notion_api/core.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/notion_api/core.rb b/lib/notion_api/core.rb index ec7c827..6241946 100644 --- a/lib/notion_api/core.rb +++ b/lib/notion_api/core.rb @@ -191,8 +191,8 @@ def extract_title(clean_id, jsonified_record_response) else # titles for images are called source, while titles for text-based blocks are called title, so lets dynamically grab it # https://stackoverflow.com/questions/23765996/get-all-keys-from-ruby-hash/23766007 - title_value = filter_nil_blocks[clean_id]["value"]["properties"].keys[0] - Core.type_whitelist.include?(filter_nil_blocks[clean_id]["value"]["type"]) ? nil : jsonified_record_response["block"][clean_id]["value"]["properties"][title_value].flatten[0] + title_key = 'title' + Core.type_whitelist.include?(filter_nil_blocks[clean_id]["value"]["type"]) ? nil : jsonified_record_response["block"][clean_id]["value"]["properties"][title_key].flatten[0] end end