notion_ruby_mapping 3.0.1 → 3.0.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ece1ac33c211611615d1f0b92226bca51edd194388b27933e26df6571bad0a87
|
|
4
|
+
data.tar.gz: 4b6d93d160ef3bd5d816cabe792915400707896ce756bc928c3bef155623f209
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 233341059b2dda960cd8a9abb71b4e15e8ad792c93e6ba59a1078c25baa66265612d1200081b3d0214b37f6f2feaf3d6a4614de13eb480826ee10e218b018bf8
|
|
7
|
+
data.tar.gz: 40984e23f340fa1fd87698c6b3382edd0d22a782844ba6808c3e776ca2fb06b462244377b0608b1f2280bb182924494a7ebefe8628997caba69ffdede60459e7
|
data/README.md
CHANGED
|
@@ -136,6 +136,8 @@ NotionRubyMapping.configuration { |c| c.notion_token = ENV["NOTION_API_TOKEN"] }
|
|
|
136
136
|
|
|
137
137
|
## 3. ChangeLog
|
|
138
138
|
|
|
139
|
+
- 2025/10/25 [v3.0.3] Add default template option for create_child_page and build_child_page
|
|
140
|
+
- 2025/10/22 [v3.0.2] Add template_page option for create_child_page and build_child_page
|
|
139
141
|
- 2025/10/4 [v3.0.1] Add place_property
|
|
140
142
|
- 2025/9/15 [v3.0.0] updates for Notion-Version 2025-09-03 (Add DataSource class)
|
|
141
143
|
- 2025/6/29 [v2.0.1] add creating FileUploadObject with external url
|
|
@@ -7,7 +7,7 @@ module NotionRubyMapping
|
|
|
7
7
|
# @param [Hash, nil] json
|
|
8
8
|
# @param [String, nil] id
|
|
9
9
|
# @param [Array<Property, Class, String>] assign
|
|
10
|
-
def initialize(json: nil, id: nil, assign: [], parent: nil)
|
|
10
|
+
def initialize(json: nil, id: nil, assign: [], parent: nil, template_page: nil)
|
|
11
11
|
@nc = NotionCache.instance
|
|
12
12
|
@json = json
|
|
13
13
|
@id = @nc.hex_id(id || @json && @json["id"])
|
|
@@ -16,7 +16,14 @@ module NotionRubyMapping
|
|
|
16
16
|
@new_record = true unless parent.nil?
|
|
17
17
|
raise StandardError, "Unknown id" if !is_a?(List) && !is_a?(Block) && @id.nil? && parent.nil?
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
payload_json = {}
|
|
20
|
+
payload_json["parent"] = parent if !is_a?(Block) && parent
|
|
21
|
+
if template_page == "default"
|
|
22
|
+
payload_json["template"] = {"type" => "default"}
|
|
23
|
+
elsif template_page
|
|
24
|
+
payload_json["template"] = {"type" => "template_id", "template_id" => template_page.id}
|
|
25
|
+
end
|
|
26
|
+
@payload = Payload.new(payload_json)
|
|
20
27
|
@property_cache = nil
|
|
21
28
|
@created_time = nil
|
|
22
29
|
@last_edited_time = nil
|
|
@@ -40,9 +40,9 @@ module NotionRubyMapping
|
|
|
40
40
|
# @param [Array<Property, Class, String>] assign
|
|
41
41
|
# @return [NotionRubyMapping::Base]
|
|
42
42
|
# @see https://www.notion.so/hkob/DataSource-1462b24502424539a4231bedc07dc2f5#c217ce78020a4de79b720790fce3092d
|
|
43
|
-
def build_child_page(*assign)
|
|
43
|
+
def build_child_page(*assign, template_page: nil)
|
|
44
44
|
assign = properties.map { |p| [p.class, p.name] }.flatten if assign.empty?
|
|
45
|
-
page = Page.new assign: assign, parent: {"data_source_id" => @id}
|
|
45
|
+
page = Page.new assign: assign, parent: {"data_source_id" => @id}, template_page: template_page
|
|
46
46
|
pp = page.properties
|
|
47
47
|
pp.clear_will_update
|
|
48
48
|
yield page, pp if block_given?
|
|
@@ -53,9 +53,9 @@ module NotionRubyMapping
|
|
|
53
53
|
# @param [Boolean] dry_run true if dry_run
|
|
54
54
|
# @return [NotionRubyMapping::Base]
|
|
55
55
|
# @see https://www.notion.so/hkob/DataSource-1462b24502424539a4231bedc07dc2f5#c217ce78020a4de79b720790fce3092d
|
|
56
|
-
def create_child_page(*assign, dry_run: false)
|
|
56
|
+
def create_child_page(*assign, template_page: nil, dry_run: false)
|
|
57
57
|
assign = properties.map { |p| [p.class, p.name] }.flatten if assign.empty?
|
|
58
|
-
page = Page.new assign: assign, parent: {"data_source_id" => @id}
|
|
58
|
+
page = Page.new assign: assign, parent: {"data_source_id" => @id}, template_page: template_page
|
|
59
59
|
pp = page.properties
|
|
60
60
|
pp.clear_will_update
|
|
61
61
|
yield page, pp if block_given?
|