notion_ruby_mapping 4.0.0 → 4.0.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/README.md +17 -8
- data/lib/notion_ruby_mapping/controllers/notion_cache.rb +22 -0
- data/lib/notion_ruby_mapping/objects/comment_object.rb +48 -2
- data/lib/notion_ruby_mapping/version.rb +1 -1
- data/mise.toml +2 -0
- data/notion_ruby_mapping.gemspec +1 -0
- metadata +16 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 60caedd2da9ab654284cb0d15f93fdef648e3d93b85e73a2d8e0b074657b6658
|
|
4
|
+
data.tar.gz: 5b2474e262b7ed381d6ab266a898df26b736d5990c2cb441391c730615b40b8d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0785e9cd53092787c84aedeba453559934d4501cc73f75ffed2be447d939dc817ee69ee05696af03025d21184d495fdd2c699336e756bca3d84511cc6595d7b0'
|
|
7
|
+
data.tar.gz: 69e57b27cfa5d4ff92e1c71b1de13ab44f6706fe2c83cde73aa82f65d24e02788898e8deafe8ed240ef9f752a3e919998d367aa099cd0efca87a226cc8ba93a6
|
data/README.md
CHANGED
|
@@ -15,10 +15,11 @@ Development note is here.
|
|
|
15
15
|
- [notion\_ruby\_mapping](#notion_ruby_mapping)
|
|
16
16
|
- [Table of Contents](#table-of-contents)
|
|
17
17
|
- [0. History of Major Changes / 主な変更履歴](#0-history-of-major-changes--主な変更履歴)
|
|
18
|
-
- [0.1 Changes in
|
|
19
|
-
- [0.2 Changes in
|
|
20
|
-
- [0.3 Changes in v0.
|
|
21
|
-
- [0.4 Changes in v0.
|
|
18
|
+
- [0.1 Changes in v4.0.0](#01-changes-in-v400)
|
|
19
|
+
- [0.2 Changes in v3.0.0](#02-changes-in-v300)
|
|
20
|
+
- [0.3 Changes in v0.7.0](#03-changes-in-v070)
|
|
21
|
+
- [0.4 Changes in v0.6.0](#04-changes-in-v060)
|
|
22
|
+
- [0.5 Changes in v0.5.0](#05-changes-in-v050)
|
|
22
23
|
- [1. Installation / インストール方法](#1-installation--インストール方法)
|
|
23
24
|
- [2. How to use / 利用方法](#2-how-to-use--利用方法)
|
|
24
25
|
- [2.1 Create a New Integration / インテグレーションの作成](#21-create-a-new-integration--インテグレーションの作成)
|
|
@@ -33,7 +34,13 @@ Development note is here.
|
|
|
33
34
|
|
|
34
35
|
## 0. History of Major Changes / 主な変更履歴
|
|
35
36
|
|
|
36
|
-
### 0.1 Changes in
|
|
37
|
+
### 0.1 Changes in v4.0.0
|
|
38
|
+
|
|
39
|
+
NotionRubyMapping v4.0.0 now supports Notion-Version 2026-03-11.
|
|
40
|
+
|
|
41
|
+
NotionRubyMapping v4.0.0 は、Notion-Version 2026-03-11 に対応しました。
|
|
42
|
+
|
|
43
|
+
### 0.2 Changes in v3.0.0
|
|
37
44
|
|
|
38
45
|
NotionRubyMapping v3.0.0 now supports Notion-Version 2025-09-03.
|
|
39
46
|
|
|
@@ -41,13 +48,13 @@ NotionRubyMapping v3.0.0 は、Notion-Version 2025-09-03 に対応しました
|
|
|
41
48
|
これまで Database で実行していた API は、ほとんど DataSource の API に変更になりました。
|
|
42
49
|
そのため、NotionRubyMapping でも新規に DataSource クラスを追加しました。
|
|
43
50
|
|
|
44
|
-
### 0.
|
|
51
|
+
### 0.3 Changes in v0.7.0
|
|
45
52
|
|
|
46
53
|
Since the number of Japanese users has increased, we decided to include Japanese as well. In addition, we have simplified the method of setting up integration tokens.
|
|
47
54
|
|
|
48
55
|
日本のユーザが増えたので、日本語も併記することにしました。また、インテグレーショントークンの設定方法を簡単にしました。
|
|
49
56
|
|
|
50
|
-
### 0.
|
|
57
|
+
### 0.4 Changes in v0.6.0
|
|
51
58
|
|
|
52
59
|
NotionRubyMapping v0.6.0 now supports Notion-Version 2022-06-28.
|
|
53
60
|
~~In 2022-06-28, property values are no longer returned when retrieving pages. NotionRubyMapping temporarily creates a Property Object and calls the retrieve a property item API when a value is needed. Therefore, users do not need to be aware of any differences, and existing scripts should work as they are.~~
|
|
@@ -55,7 +62,7 @@ NotionRubyMapping v0.6.0 now supports Notion-Version 2022-06-28.
|
|
|
55
62
|
NotionRubyMapping v0.6.0 は、Notion-Version 2022-06-28 に対応しました。
|
|
56
63
|
~~ 2022-06-28 では、ページを取得する際にプロパティ値を返さなくなりました。NotionRubyMapping は、一時的に Property Object を作成し、値が必要なときにプロパティ項目を取得する API を呼び出します。そのため、ユーザーはこの違いを意識する必要はなく、既存のスクリプトはそのまま動作するはずです。~~
|
|
57
64
|
|
|
58
|
-
### 0.
|
|
65
|
+
### 0.5 Changes in v0.5.0
|
|
59
66
|
|
|
60
67
|
NotionRubyMapping v0.5.0 now supports block updates.
|
|
61
68
|
For efficiency, subclasses are provided under Block class. As a result, they are no longer compatible with the scripts used in v0.4.0.
|
|
@@ -136,6 +143,8 @@ NotionRubyMapping.configuration { |c| c.notion_token = ENV["NOTION_API_TOKEN"] }
|
|
|
136
143
|
|
|
137
144
|
## 3. ChangeLog
|
|
138
145
|
|
|
146
|
+
- 2027/5/4 [v4.0.1] Add retrieve / update / delete a comment
|
|
147
|
+
- 2027/3/23 [v4.0.0] Add markdown support, headnig_4, toggle_heading_4, and position support for appending blocks
|
|
139
148
|
- 2026/1/25 [v3.0.6] add move page, list templates, and create child page to page
|
|
140
149
|
- 2025/12/15 [v3.0.5] add AudioBlock
|
|
141
150
|
- 2025/12/9 [v3.0.4] Fix the issue where page.parent could not be executed for pages with a data source as parent
|
|
@@ -101,6 +101,14 @@ module NotionRubyMapping
|
|
|
101
101
|
"v1/comments"
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
+
def comment_path(comment_id)
|
|
105
|
+
"v1/comments/#{comment_id}"
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def comment_request(comment_id)
|
|
109
|
+
request :get, comment_path(comment_id)
|
|
110
|
+
end
|
|
111
|
+
|
|
104
112
|
def complete_a_file_upload_path(file_id)
|
|
105
113
|
"v1/file_uploads/#{file_id}/complete"
|
|
106
114
|
end
|
|
@@ -213,6 +221,12 @@ module NotionRubyMapping
|
|
|
213
221
|
request :delete, block_path(id)
|
|
214
222
|
end
|
|
215
223
|
|
|
224
|
+
# @param [String] id
|
|
225
|
+
# @return [Hash]
|
|
226
|
+
def destroy_comment_request(id)
|
|
227
|
+
request :delete, comment_path(id)
|
|
228
|
+
end
|
|
229
|
+
|
|
216
230
|
# @param [String] fname
|
|
217
231
|
# @param [String] id
|
|
218
232
|
# @param [Hash] options
|
|
@@ -428,6 +442,14 @@ module NotionRubyMapping
|
|
|
428
442
|
request :patch, block_path(block_id), payload
|
|
429
443
|
end
|
|
430
444
|
|
|
445
|
+
def update_comment_request(comment_id, rich_text: nil, markdown: nil)
|
|
446
|
+
if rich_text
|
|
447
|
+
request :patch, comment_path(comment_id), {"rich_text" => rich_text}
|
|
448
|
+
else
|
|
449
|
+
request :patch, comment_path(comment_id), {"markdown" => markdown}
|
|
450
|
+
end
|
|
451
|
+
end
|
|
452
|
+
|
|
431
453
|
# @param [String] id page_id (with or without "-")
|
|
432
454
|
# @param [Hash] payload
|
|
433
455
|
# def update_database(id, payload)
|
|
@@ -4,19 +4,36 @@ module NotionRubyMapping
|
|
|
4
4
|
# CommentObject
|
|
5
5
|
class CommentObject
|
|
6
6
|
# @param [String] text_objects
|
|
7
|
-
def initialize(text_objects: nil, json: {})
|
|
7
|
+
def initialize(id: nil, text_objects: nil, json: {})
|
|
8
|
+
nc = NotionCache.instance
|
|
8
9
|
if text_objects
|
|
10
|
+
@id = nc.hex_id id
|
|
9
11
|
@text_objects = RichTextArray.new "rich_text", text_objects: text_objects
|
|
10
12
|
@json = {}
|
|
11
13
|
elsif json
|
|
12
14
|
@json = json
|
|
15
|
+
@id = nc.hex_id json["id"]
|
|
13
16
|
@text_objects = RichTextArray.new "rich_text", json: json["rich_text"]
|
|
14
17
|
else
|
|
15
18
|
raise StandardError, "Either text_objects or json is required CommentObject"
|
|
16
19
|
end
|
|
17
20
|
@will_update = false
|
|
18
21
|
end
|
|
19
|
-
attr_reader :will_update, :text_objects, :json
|
|
22
|
+
attr_reader :will_update, :text_objects, :json, :id
|
|
23
|
+
|
|
24
|
+
def self.find(comment_id)
|
|
25
|
+
new json: NotionCache.instance.comment_request(comment_id)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def destroy(dry_run: false)
|
|
29
|
+
if dry_run
|
|
30
|
+
Base.dry_run_script :delete, NotionCache.instance.comment_path(id)
|
|
31
|
+
else
|
|
32
|
+
json = NotionCache.instance.destroy_comment_request id
|
|
33
|
+
@text_objects = RichTextArray.new "rich_text", json: json["rich_text"]
|
|
34
|
+
self
|
|
35
|
+
end
|
|
36
|
+
end
|
|
20
37
|
|
|
21
38
|
def discussion_id
|
|
22
39
|
NotionCache.instance.hex_id @json["discussion_id"]
|
|
@@ -26,5 +43,34 @@ module NotionRubyMapping
|
|
|
26
43
|
def full_text
|
|
27
44
|
@text_objects.full_text
|
|
28
45
|
end
|
|
46
|
+
|
|
47
|
+
def markdown=(markdown)
|
|
48
|
+
@markdown = markdown
|
|
49
|
+
@will_update = true
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def rich_text_objects=(text_objects)
|
|
53
|
+
@text_objects.rich_text_objects = text_objects
|
|
54
|
+
@will_update = true
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def save(dry_run: false)
|
|
58
|
+
return unless @will_update
|
|
59
|
+
|
|
60
|
+
if dry_run
|
|
61
|
+
json = @markdown ? {"markdown" => @markdown} : {"rich_text" => @text_objects.property_values_json}
|
|
62
|
+
@markdown = nil
|
|
63
|
+
Base.dry_run_script :patch, NotionCache.instance.comment_path(id), json
|
|
64
|
+
else
|
|
65
|
+
json = if @markdown
|
|
66
|
+
NotionCache.instance.update_comment_request id, markdown: @markdown
|
|
67
|
+
else
|
|
68
|
+
NotionCache.instance.update_comment_request id, rich_text: @text_objects.property_values_json
|
|
69
|
+
end
|
|
70
|
+
@markdown = nil
|
|
71
|
+
@text_objects = RichTextArray.new "rich_text", json: json["rich_text"]
|
|
72
|
+
@will_update = false
|
|
73
|
+
end
|
|
74
|
+
end
|
|
29
75
|
end
|
|
30
76
|
end
|
data/mise.toml
ADDED
data/notion_ruby_mapping.gemspec
CHANGED
|
@@ -38,6 +38,7 @@ Gem::Specification.new do |spec|
|
|
|
38
38
|
spec.add_dependency "faraday-multipart"
|
|
39
39
|
spec.add_dependency "mime-types"
|
|
40
40
|
|
|
41
|
+
spec.add_development_dependency "ostruct"
|
|
41
42
|
spec.add_development_dependency "pry"
|
|
42
43
|
spec.add_development_dependency "pry-byebug"
|
|
43
44
|
spec.add_development_dependency "rb-readline"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: notion_ruby_mapping
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hiroyuki KOBAYASHI
|
|
@@ -51,6 +51,20 @@ dependencies:
|
|
|
51
51
|
- - ">="
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: ostruct
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
54
68
|
- !ruby/object:Gem::Dependency
|
|
55
69
|
name: pry
|
|
56
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -314,6 +328,7 @@ files:
|
|
|
314
328
|
- lib/notion_ruby_mapping/properties/url_property.rb
|
|
315
329
|
- lib/notion_ruby_mapping/properties/verification_property.rb
|
|
316
330
|
- lib/notion_ruby_mapping/version.rb
|
|
331
|
+
- mise.toml
|
|
317
332
|
- notion_ruby_mapping.gemspec
|
|
318
333
|
- tools/an
|
|
319
334
|
homepage: https://github.com/hkob/notion_ruby_mapping.git
|