notion_ruby_mapping 0.6.8 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 378e8aecdacdabc3fd951939783195ed13f2e56665a202a8fe3cf9a2d66e0fab
|
4
|
+
data.tar.gz: d92c738818763b3d4d49d06e1f7c326ec2fc60e5214162a8185c4f7a8c3f501a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0dd2673402bbe54ccd135331c3476f4009af7c68411895f2244288eae761c8975e5bb7e9e39d14ba5d2fc58b96cb38c8dd4f401de2a422d0ebfaeff4c29277ed
|
7
|
+
data.tar.gz: 331fadb7063f5d72c049a7f84907174b3470be179340539796772e31a3ff61dd10222d1638d26688c67fe8470501235c3025c2ebda46ba8942e404cc256aad91
|
data/README.md
CHANGED
@@ -1,97 +1,131 @@
|
|
1
1
|
# notion_ruby_mapping
|
2
2
|
|
3
|
-
Notion Ruby
|
3
|
+
Notion Ruby Mapping is a library that makes it easy to access data on Notion using Ruby. It is currently under development.
|
4
4
|
|
5
|
-
|
5
|
+
Notion Ruby Mapping は Ruby で Notion 上のデータを簡単にアクセスできるようにするライブラリです。現在開発中です。
|
6
|
+
|
7
|
+
Development note is here.
|
8
|
+
|
9
|
+
開発ノートは以下の URL にあります。
|
10
|
+
|
11
|
+
→ [Idea note of "notion_ruby_mapping"](https://www.notion.so/hkob/Idea-note-of-notion_ruby_mapping-3b0a3bb3c171438a830f9579d41df501)
|
6
12
|
|
7
13
|
## Table of Contents
|
8
14
|
|
9
|
-
- [
|
15
|
+
- [notion\_ruby\_mapping](#notion_ruby_mapping)
|
10
16
|
- [Table of Contents](#table-of-contents)
|
11
|
-
- [0. Changes](#0-changes)
|
12
|
-
- [0.1 Changes in v0.
|
13
|
-
- [0.2 Changes in v0.
|
14
|
-
|
15
|
-
- [
|
16
|
-
|
17
|
-
- [2.
|
18
|
-
- [2.
|
19
|
-
- [2.
|
20
|
-
- [2.
|
17
|
+
- [0. History of Major Changes / 主な変更履歴](#0-history-of-major-changes--主な変更履歴)
|
18
|
+
- [0.1 Changes in v0.7.0](#01-changes-in-v070)
|
19
|
+
- [0.2 Changes in v0.6.0](#02-changes-in-v060)
|
20
|
+
- [0.3 Changes in v0.5.0](#03-changes-in-v050)
|
21
|
+
- [1. Installation / インストール方法](#1-installation--インストール方法)
|
22
|
+
- [2. How to use / 利用方法](#2-how-to-use--利用方法)
|
23
|
+
- [2.1 Create a New Integration / インテグレーションの作成](#21-create-a-new-integration--インテグレーションの作成)
|
24
|
+
- [2.2 Set your integration token / インテグレーショントークンの設定](#22-set-your-integration-token--インテグレーショントークンの設定)
|
25
|
+
- [2.3 Sample codes / サンプルコード](#23-sample-codes--サンプルコード)
|
26
|
+
- [2.4. Another example code (Use case) / その他の使用例 (ユースケース)](#24-another-example-code-use-case--その他の使用例-ユースケース)
|
27
|
+
- [2.5 API reference / API リファレンス](#25-api-reference--api-リファレンス)
|
21
28
|
- [3. ChangeLog](#3-changelog)
|
22
|
-
- [4. Contributing](#4-contributing)
|
23
|
-
- [5. License](#5-license)
|
24
|
-
- [6. Code of Conduct](#6-code-of-conduct)
|
29
|
+
- [4. Contributing / 貢献](#4-contributing--貢献)
|
30
|
+
- [5. License / ライセンス](#5-license--ライセンス)
|
31
|
+
- [6. Code of Conduct / 行動規範](#6-code-of-conduct--行動規範)
|
32
|
+
|
33
|
+
## 0. History of Major Changes / 主な変更履歴
|
34
|
+
|
35
|
+
### 0.1 Changes in v0.7.0
|
25
36
|
|
26
|
-
|
37
|
+
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.
|
27
38
|
|
28
|
-
|
39
|
+
日本のユーザが増えたので、日本語も併記することにしました。また、インテグレーショントークンの設定方法を簡単にしました。
|
40
|
+
|
41
|
+
### 0.2 Changes in v0.6.0
|
29
42
|
|
30
43
|
NotionRubyMapping v0.6.0 now supports Notion-Version 2022-06-28.
|
31
|
-
In 2022-06-28, property values are no longer returned when retrieving pages.
|
32
|
-
|
33
|
-
|
44
|
+
~~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.~~
|
45
|
+
|
46
|
+
NotionRubyMapping v0.6.0 は、Notion-Version 2022-06-28 に対応しました。
|
47
|
+
~~ 2022-06-28 では、ページを取得する際にプロパティ値を返さなくなりました。NotionRubyMapping は、一時的に Property Object を作成し、値が必要なときにプロパティ項目を取得する API を呼び出します。そのため、ユーザーはこの違いを意識する必要はなく、既存のスクリプトはそのまま動作するはずです。~~
|
34
48
|
|
35
|
-
### 0.
|
49
|
+
### 0.3 Changes in v0.5.0
|
36
50
|
|
37
51
|
NotionRubyMapping v0.5.0 now supports block updates.
|
38
52
|
For efficiency, subclasses are provided under Block class. As a result, they are no longer compatible with the scripts used in v0.4.0.
|
39
53
|
|
40
|
-
|
54
|
+
NotionRubyMapping v0.5.0 では、ブロック更新をサポートするようになりました。
|
55
|
+
効率化のため、Blockクラスの下にサブクラスが提供されています。そのため、v0.4.0で使用していたスクリプトとは互換性がなくなりました。
|
56
|
+
|
57
|
+
## 1. Installation / インストール方法
|
41
58
|
|
42
59
|
Add this line to your application's Gemfile:
|
43
60
|
|
61
|
+
アプリケーションのGemfileに次の行を追加します。:
|
62
|
+
|
44
63
|
```ruby
|
45
64
|
gem 'notion_ruby_mapping'
|
46
65
|
```
|
47
66
|
|
48
67
|
And then execute:
|
49
68
|
|
69
|
+
そして以下を実行してください:
|
70
|
+
|
50
71
|
```shell
|
51
72
|
bundle install
|
52
73
|
```
|
53
74
|
|
54
75
|
Or install it yourself as:
|
55
76
|
|
77
|
+
または、自分でインストールすることもできます。:
|
78
|
+
|
56
79
|
```shell
|
57
80
|
gem install notion_ruby_mapping
|
58
81
|
```
|
59
82
|
|
60
|
-
## 2. How to use
|
83
|
+
## 2. How to use / 利用方法
|
61
84
|
|
62
|
-
### 2.1 Create a New Integration
|
85
|
+
### 2.1 Create a New Integration / インテグレーションの作成
|
63
86
|
|
64
87
|
Please check [Notion documentation](https://developers.notion.com/docs#getting-started).
|
65
88
|
|
66
|
-
|
89
|
+
[Notion documentation](https://developers.notion.com/docs#getting-started) を読んでください。
|
90
|
+
|
91
|
+
### 2.2 Set your integration token / インテグレーショントークンの設定
|
92
|
+
|
93
|
+
From v0.7.0, it can be set with `NotionRubymapping.configuration`.
|
67
94
|
|
68
|
-
|
95
|
+
v0.7.0 から `NotionRubyMapping.configuration` で設定できるようになりました。
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
NotionRubyMapping.configuration do |config|
|
99
|
+
config.notion_token = "secret_XXXXXXXXXXXXXXXXXXXX" # write directly
|
100
|
+
config.wait = 0
|
101
|
+
end
|
102
|
+
```
|
69
103
|
|
70
|
-
```
|
71
|
-
|
72
|
-
NotionCache.instance.create_client ENV["NOTION_API_TOKEN"] # from environment
|
104
|
+
```ruby
|
105
|
+
NotionRubyMapping.configuration { |c| c.notion_token = ENV["NOTION_API_TOKEN"] } # from environment
|
73
106
|
```
|
74
107
|
|
75
|
-
### 2.3 Sample codes
|
108
|
+
### 2.3 Sample codes / サンプルコード
|
76
109
|
|
77
|
-
1. [Database and page access sample](https://www.notion.so/hkob/Database-and-page-access-sample-d30033e707194faf995741167eb2b6f8)
|
78
|
-
2. [Append block children sample](https://www.notion.so/hkob/Append-block-children-sample-3867910a437340be931cf7f2c06443c6)
|
79
|
-
3. [Update block sample](https://www.notion.so/hkob/update-block-sample-5568c1c36fe84f12b83edfe2dda83028)
|
110
|
+
1. [Database and page access sample / データベースとページのアクセスサンプル](https://www.notion.so/hkob/Database-and-page-access-sample-d30033e707194faf995741167eb2b6f8)
|
111
|
+
2. [Append block children sample / 子ブロック要素の追加サンプル](https://www.notion.so/hkob/Append-block-children-sample-3867910a437340be931cf7f2c06443c6)
|
112
|
+
3. [Update block sample / ブロック要素の更新サンプル](https://www.notion.so/hkob/update-block-sample-5568c1c36fe84f12b83edfe2dda83028)
|
80
113
|
|
81
|
-
### 2.4. Another example code (Use case)
|
114
|
+
### 2.4. Another example code (Use case) / その他の使用例 (ユースケース)
|
82
115
|
|
83
|
-
1. [Set icon to all icon unsettled pages](examples/set_icon_to_all_icon_unsettled_pages.md)
|
84
|
-
2. [Renumbering pages](examples/renumbering_pages.md)
|
85
|
-
3. [Change title](examples/change_title.md)
|
86
|
-
4. [Create ER Diagram from Notion database](https://www.notion.so/hkob/notionErDiagram-Sample-1720c2199c534ca08138cde38f31f710)
|
87
|
-
5. [Create Sitemap from Notion pages](https://www.notion.so/hkob/NotionSitemap-sample-14e195c83d024c5382aab09210916c87)
|
116
|
+
1. [Set icon to all icon unsettled pages / 全てのページのアイコンを同一に設定](examples/set_icon_to_all_icon_unsettled_pages.md)
|
117
|
+
2. [Renumbering pages / ページのナンバリング](examples/renumbering_pages.md)
|
118
|
+
3. [Change title / タイトルの変更](examples/change_title.md)
|
119
|
+
4. [Create ER Diagram from Notion database / Notion データベースの ER 図を作成](https://www.notion.so/hkob/notionErDiagram-Sample-1720c2199c534ca08138cde38f31f710)
|
120
|
+
5. [Create Sitemap from Notion pages / Notion page からサイトマップを作成](https://www.notion.so/hkob/NotionSitemap-sample-14e195c83d024c5382aab09210916c87)
|
88
121
|
|
89
|
-
### 2.5 API reference
|
122
|
+
### 2.5 API reference / API リファレンス
|
90
123
|
|
91
124
|
1. [Notion Ruby Mapping Public API reference](https://www.notion.so/hkob/Notion-Ruby-Mapping-Public-API-reference-4091aca15b664299b63e6253b7601fec)
|
92
125
|
|
93
126
|
## 3. ChangeLog
|
94
127
|
|
128
|
+
- 2022/11/28 [v0.7.0] add this_week filter and NotionRubyMapping.configure
|
95
129
|
- 2022/11/13 [v0.6.8] remove error checking for start and end dates, add Users.all, and change Rollup and Formula query specification
|
96
130
|
- 2022/9/2 [v0.6.7] add support for Status property, is_toggleable for headings block, and page property values
|
97
131
|
- 2022/8/10 [v0.6.6] Bug fix(notionSitemap.rb): Skip if child page is empty.
|
@@ -127,14 +161,20 @@ NotionCache.instance.create_client ENV["NOTION_API_TOKEN"] # from environment
|
|
127
161
|
- 2022/2/13 added Page#set_icon
|
128
162
|
- 2022/2/13 First commit
|
129
163
|
|
130
|
-
## 4. Contributing
|
164
|
+
## 4. Contributing / 貢献
|
165
|
+
|
166
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/hkob/notion_ruby_mapping>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/hkob/notion_ruby_mapping/blob/main/CODE_OF_CONDUCT.md).
|
131
167
|
|
132
|
-
|
168
|
+
バグレポートとプルリクエストは、<https://github.com/hkob/notion_ruby_mapping>のGithubで大歓迎です。このプロジェクトは、コラボレーションのための安全で居心地の良いスペースであることを目的としており、貢献者は[行動規範](https://github.com/hkob/notion_ruby_mapping/blob/main/code_of_conduct.md)を遵守することが期待されています。
|
133
169
|
|
134
|
-
## 5. License
|
170
|
+
## 5. License / ライセンス
|
135
171
|
|
136
172
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
137
173
|
|
138
|
-
|
174
|
+
GEMは、[MITライセンス](https://opensource.org/licenses/mit)の条件の下でオープンソースとして入手できます。
|
175
|
+
|
176
|
+
## 6. Code of Conduct / 行動規範
|
177
|
+
|
178
|
+
Everyone interacting in the NotionRubyMapping project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/hkob/notion_ruby_mapping/blob/main/CODE_OF_CONDUCT.md).
|
139
179
|
|
140
|
-
|
180
|
+
NotionRubyMappingプロジェクトのコードベース、問題トラッカー、チャットルーム、メーリングリストで対話する全員が[行動規範](https://github.com/hkob/notion_ruby_mapping/blob/main/code_of_conduct.md)に従うことが期待されています。
|
@@ -20,11 +20,12 @@ module NotionRubyMapping
|
|
20
20
|
builder.adapter Faraday.default_adapter
|
21
21
|
end
|
22
22
|
@notion_token = nil
|
23
|
-
@wait = 0
|
23
|
+
@wait = 0.3333
|
24
24
|
@debug = false
|
25
25
|
end
|
26
26
|
attr_reader :object_hash
|
27
27
|
attr_writer :client # for test only
|
28
|
+
attr_accessor :notion_token, :wait, :debug
|
28
29
|
|
29
30
|
# @param [String] block_id
|
30
31
|
# @return [String (frozen)] block_path
|
@@ -239,7 +240,7 @@ module NotionRubyMapping
|
|
239
240
|
# @param [Hash] options
|
240
241
|
# @return [Hash] response hash
|
241
242
|
def request(method, path, options = {})
|
242
|
-
raise "Please call `
|
243
|
+
raise "Please call `NotionRubyMapping.configure' before using other methods" unless @notion_token
|
243
244
|
|
244
245
|
sleep @wait
|
245
246
|
response = @client.send(method) do |request|
|
@@ -137,6 +137,14 @@ module NotionRubyMapping
|
|
137
137
|
make_filter_query "past_year", {}, condition: condition, another_type: another_type
|
138
138
|
end
|
139
139
|
|
140
|
+
# @param [String] condition Rollup name
|
141
|
+
# @param [String] another_type Rollup type
|
142
|
+
# @return [NotionRubyMapping::Query] generated Query object
|
143
|
+
# @see
|
144
|
+
def filter_this_week(condition: nil, another_type: nil)
|
145
|
+
make_filter_query "this_week", {}, condition: condition, another_type: another_type
|
146
|
+
end
|
147
|
+
|
140
148
|
# @param [String] condition Rollup name
|
141
149
|
# @param [String] another_type Rollup type
|
142
150
|
# @return [NotionRubyMapping::Query] generated Query object
|
data/lib/notion_ruby_mapping.rb
CHANGED
@@ -25,3 +25,11 @@ require_relative "notion_ruby_mapping/version"
|
|
25
25
|
require_relative "notion_ruby_mapping/#{key}/#{klass}"
|
26
26
|
end
|
27
27
|
end
|
28
|
+
|
29
|
+
module NotionRubyMapping
|
30
|
+
def configure
|
31
|
+
yield NotionRubyMapping::NotionCache.instance
|
32
|
+
end
|
33
|
+
module_function :configure
|
34
|
+
end
|
35
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion_ruby_mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroyuki KOBAYASHI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|