notion-ruby-client 0.0.8 → 1.0.0.pre.beta2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +5 -0
- data/.devcontainer/boot.sh +1 -0
- data/.devcontainer/devcontainer.json +30 -0
- data/.github/workflows/ci.yml +1 -0
- data/.gitignore +7 -0
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +43 -0
- data/CONTRIBUTING.md +51 -0
- data/Gemfile.lock +38 -11
- data/README.md +354 -108
- data/bin/console +31 -0
- data/lib/notion/api/endpoints/blocks.rb +51 -7
- data/lib/notion/api/endpoints/databases.rb +60 -53
- data/lib/notion/api/endpoints/pages.rb +24 -7
- data/lib/notion/api/endpoints/search.rb +41 -0
- data/lib/notion/api/endpoints/users.rb +14 -3
- data/lib/notion/api/endpoints.rb +3 -1
- data/lib/notion/api/errors/too_many_requests.rb +15 -0
- data/lib/notion/api/errors.rb +0 -2
- data/lib/notion/config.rb +2 -0
- data/lib/notion/pagination/cursor.rb +5 -2
- data/lib/notion/version.rb +2 -2
- data/lib/notion-ruby-client.rb +2 -0
- data/notion-ruby-client.gemspec +5 -3
- data/spec/fixtures/notion/block.yml +146 -0
- data/spec/fixtures/notion/block_append_children.yml +76 -62
- data/spec/fixtures/notion/block_children.yml +80 -65
- data/spec/fixtures/notion/create_database.yml +67 -58
- data/spec/fixtures/notion/create_page.yml +68 -59
- data/spec/fixtures/notion/database.yml +78 -61
- data/spec/fixtures/notion/database_query.yml +81 -62
- data/spec/fixtures/notion/delete_block.yml +145 -0
- data/spec/fixtures/notion/page.yml +70 -57
- data/spec/fixtures/notion/page_property_item.yml +143 -0
- data/spec/fixtures/notion/paginated_block_children.yml +296 -242
- data/spec/fixtures/notion/paginated_database_query.yml +79 -62
- data/spec/fixtures/notion/paginated_databases_list.yml +78 -61
- data/spec/fixtures/notion/paginated_search.yml +301 -0
- data/spec/fixtures/notion/paginated_users_list.yml +143 -130
- data/spec/fixtures/notion/search.yml +160 -0
- data/spec/fixtures/notion/search_with_query.yml +152 -0
- data/spec/fixtures/notion/update_block.yml +148 -0
- data/spec/fixtures/notion/update_database.yml +152 -0
- data/spec/fixtures/notion/update_page.yml +71 -59
- data/spec/fixtures/notion/users.yml +69 -56
- data/spec/fixtures/notion/users_list.yml +143 -130
- data/spec/fixtures/notion/users_me.yml +144 -0
- data/spec/notion/api/endpoints/blocks_spec.rb +44 -12
- data/spec/notion/api/endpoints/databases_spec.rb +22 -27
- data/spec/notion/api/endpoints/pages_spec.rb +13 -16
- data/spec/notion/api/endpoints/search_spec.rb +26 -0
- data/spec/notion/api/endpoints/users_spec.rb +9 -4
- data/spec/notion/pagination/cursor_spec.rb +126 -0
- metadata +67 -15
- data/.rspec_status +0 -19
- data/notion-ruby-client-0.0.4.gem +0 -0
- data/scratchpad.rb +0 -22
- data/screenshots/create_notion_bot.png +0 -0
- data/spec/fixtures/notion/databases_list.yml +0 -133
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4348b9a12b6bc452687efb981e6c6f3c906266a4bd1b17358b66f6f08c8ed129
|
4
|
+
data.tar.gz: 63731653acd9350365d52356ea72aedcd1bf1d1ac2d284f4729e9d16ca534390
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ec3bccc76218a9ea87dfe0c5af9b32e905c3d6cdf19fecd0d4cd8939cfb0b0f8755a0510ffcc085fde93b9bf5b1af847b42d7676dd7325cd7bd745f6c847838
|
7
|
+
data.tar.gz: cb36c83418dfc7e53764824314fab9892f21081b8c34731d3dd6c6649b0b269850b58042e69e2dd07b53b772a01894f6ca01852ea7ae391e5af6778b4d4fc3ab
|
@@ -0,0 +1,5 @@
|
|
1
|
+
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby/.devcontainer/base.Dockerfile
|
2
|
+
|
3
|
+
# [Choice] Ruby version: 3, 3.0, 2, 2.7, 2.6
|
4
|
+
ARG VARIANT="3.0"
|
5
|
+
FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
|
@@ -0,0 +1 @@
|
|
1
|
+
bundle install
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
|
2
|
+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby
|
3
|
+
{
|
4
|
+
"name": "Ruby",
|
5
|
+
"build": {
|
6
|
+
"dockerfile": "Dockerfile",
|
7
|
+
"context": "..",
|
8
|
+
"args": {
|
9
|
+
// Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6
|
10
|
+
"VARIANT": "2.7",
|
11
|
+
}
|
12
|
+
},
|
13
|
+
|
14
|
+
// Set *default* container specific settings.json values on container create.
|
15
|
+
"settings": {},
|
16
|
+
|
17
|
+
// Add the IDs of extensions you want installed when the container is created.
|
18
|
+
"extensions": [
|
19
|
+
"rebornix.Ruby"
|
20
|
+
],
|
21
|
+
|
22
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
23
|
+
// "forwardPorts": [],
|
24
|
+
|
25
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
26
|
+
"postCreateCommand": ".devcontainer/boot.sh",
|
27
|
+
|
28
|
+
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
|
29
|
+
"remoteUser": "vscode"
|
30
|
+
}
|
data/.github/workflows/ci.yml
CHANGED
data/.gitignore
ADDED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,46 @@
|
|
1
|
+
### 1.0.0-beta2 (2022-03-24)
|
2
|
+
|
3
|
+
#### Fixed
|
4
|
+
|
5
|
+
Fixed compat with Rails 7
|
6
|
+
|
7
|
+
### 1.0.0-beta1 (2022-03-24)
|
8
|
+
|
9
|
+
#### New
|
10
|
+
|
11
|
+
- Add support for the following new endpoints:
|
12
|
+
- [Delete a block](https://developers.notion.com/reference/get-block-children)
|
13
|
+
- [Retrieve your token's bot user](https://developers.notion.com/reference/get-self)
|
14
|
+
- [Retrieve a page property item](https://developers.notion.com/reference/retrieve-a-page-property)
|
15
|
+
- Update Notion API Version to `2022-02-22` (thanks @hkob!)
|
16
|
+
- Remove the following deprecated endpoint:
|
17
|
+
- [List databases](https://developers.notion.com/reference/get-databases)
|
18
|
+
- Add Codespaces and CONTRIBUTING.md command for better DX
|
19
|
+
- Overhauled documentation
|
20
|
+
|
21
|
+
#### Upgrade instructions
|
22
|
+
|
23
|
+
- Please refer to the Notion Changelog to see breaking changes for version `2022-02-22`: https://developers.notion.com/changelog/releasing-notion-version-2022-02-22
|
24
|
+
|
25
|
+
### 0.1.0-beta1 (2021-08-29)
|
26
|
+
|
27
|
+
#### New
|
28
|
+
|
29
|
+
- Add support for the following new endpoints:
|
30
|
+
- [Update database](https://developers.notion.com/reference/update-a-database)
|
31
|
+
- [Update page](https://developers.notion.com/reference/patch-page)
|
32
|
+
- [Retrieve a block](https://developers.notion.com/reference/retrieve-a-block)
|
33
|
+
- [Update a block](https://developers.notion.com/reference/update-a-block)
|
34
|
+
- [Search](https://developers.notion.com/reference/search)
|
35
|
+
- Update Notion API Version to `2021-08-16`
|
36
|
+
- Add `bin/console` command for better DX
|
37
|
+
- Overhauled documentation
|
38
|
+
|
39
|
+
#### Upgrade instructions
|
40
|
+
|
41
|
+
- Please refer to the Notion Changelog to see breaking changes for version `2021-08-16`
|
42
|
+
- Regarding this gem, a lot of `id` parameters got renamed to `block_id`, `page_id`, `user_id` and `database_id`. You might need to rename those in your code as well.
|
43
|
+
|
1
44
|
### 0.0.8 (2021-07-27)
|
2
45
|
|
3
46
|
- Bump `Notion-Version` header to `2021-05-13` (@H0R15H0)
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# CONTRIBUTING
|
2
|
+
|
3
|
+
_This project is intended to be a safe, welcoming space for collaboration. By participating in this project you agree to abide by the [Contributor Code of Conduct](CODE_OF_CONDUCT.md)._
|
4
|
+
|
5
|
+
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
|
6
|
+
|
7
|
+
## Running the project
|
8
|
+
|
9
|
+
### GitHub Codespaces
|
10
|
+
|
11
|
+
This repository includes configuration for GitHub Codespaces, making it easy to set up a cloud-based development environment. Follow [GitHub's guide](https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace#creating-a-codespace) to get started.
|
12
|
+
|
13
|
+
The Codespaces environment has the dependencies all installed, and should be ready to tinker with. Once your Codespace is set up, you can check that everything works as intended by running the specs:
|
14
|
+
|
15
|
+
```
|
16
|
+
bundle exec rake
|
17
|
+
```
|
18
|
+
|
19
|
+
### Running the project locally
|
20
|
+
|
21
|
+
You can also install the project on your machine:
|
22
|
+
|
23
|
+
```
|
24
|
+
git clone https://github.com/orbit-love/notion-ruby-client.git
|
25
|
+
cd notion-ruby-client
|
26
|
+
# if you do not have bundler installed already, run
|
27
|
+
# $ gem install bundle
|
28
|
+
# to install it
|
29
|
+
bundle install
|
30
|
+
```
|
31
|
+
|
32
|
+
You can check that everything works as intended by running the specs:
|
33
|
+
|
34
|
+
```
|
35
|
+
bundle exec rake
|
36
|
+
```
|
37
|
+
|
38
|
+
## Interactive console
|
39
|
+
|
40
|
+
You can run
|
41
|
+
|
42
|
+
```
|
43
|
+
bin/console
|
44
|
+
```
|
45
|
+
|
46
|
+
to start an IRB (interactive Ruby console) session with all the gem files loaded.
|
47
|
+
Usually, you’d start such sessions by defining your `client`:
|
48
|
+
|
49
|
+
```
|
50
|
+
client = Notion::Client.new(token: <Your Notion API token>)
|
51
|
+
```
|
data/Gemfile.lock
CHANGED
@@ -1,45 +1,68 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
notion-ruby-client (0.0.
|
4
|
+
notion-ruby-client (1.0.0.pre.beta2)
|
5
|
+
activesupport (>= 6)
|
6
|
+
dotenv
|
5
7
|
faraday (>= 1.0)
|
6
8
|
faraday_middleware
|
7
|
-
hashie
|
9
|
+
hashie (~> 5)
|
8
10
|
|
9
11
|
GEM
|
10
12
|
remote: http://rubygems.org/
|
11
13
|
specs:
|
14
|
+
activesupport (6.1.5)
|
15
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
+
i18n (>= 1.6, < 2)
|
17
|
+
minitest (>= 5.1)
|
18
|
+
tzinfo (~> 2.0)
|
19
|
+
zeitwerk (~> 2.3)
|
12
20
|
addressable (2.8.0)
|
13
21
|
public_suffix (>= 2.0.2, < 5.0)
|
14
22
|
ast (2.4.2)
|
23
|
+
concurrent-ruby (1.1.10)
|
15
24
|
crack (0.4.5)
|
16
25
|
rexml
|
17
26
|
diff-lcs (1.4.4)
|
18
|
-
|
27
|
+
dotenv (2.7.6)
|
28
|
+
faraday (1.10.0)
|
19
29
|
faraday-em_http (~> 1.0)
|
20
30
|
faraday-em_synchrony (~> 1.0)
|
21
31
|
faraday-excon (~> 1.1)
|
32
|
+
faraday-httpclient (~> 1.0)
|
33
|
+
faraday-multipart (~> 1.0)
|
22
34
|
faraday-net_http (~> 1.0)
|
23
|
-
faraday-net_http_persistent (~> 1.
|
24
|
-
|
35
|
+
faraday-net_http_persistent (~> 1.0)
|
36
|
+
faraday-patron (~> 1.0)
|
37
|
+
faraday-rack (~> 1.0)
|
38
|
+
faraday-retry (~> 1.0)
|
25
39
|
ruby2_keywords (>= 0.0.4)
|
26
40
|
faraday-em_http (1.0.0)
|
27
41
|
faraday-em_synchrony (1.0.0)
|
28
42
|
faraday-excon (1.1.0)
|
43
|
+
faraday-httpclient (1.0.1)
|
44
|
+
faraday-multipart (1.0.3)
|
45
|
+
multipart-post (>= 1.2, < 3)
|
29
46
|
faraday-net_http (1.0.1)
|
30
|
-
faraday-net_http_persistent (1.
|
31
|
-
|
47
|
+
faraday-net_http_persistent (1.2.0)
|
48
|
+
faraday-patron (1.0.0)
|
49
|
+
faraday-rack (1.0.0)
|
50
|
+
faraday-retry (1.0.3)
|
51
|
+
faraday_middleware (1.2.0)
|
32
52
|
faraday (~> 1.0)
|
33
53
|
hashdiff (1.0.1)
|
34
|
-
hashie (
|
54
|
+
hashie (5.0.0)
|
55
|
+
i18n (1.10.0)
|
56
|
+
concurrent-ruby (~> 1.0)
|
35
57
|
jaro_winkler (1.5.4)
|
58
|
+
minitest (5.15.0)
|
36
59
|
multipart-post (2.1.1)
|
37
60
|
parallel (1.20.1)
|
38
61
|
parser (3.0.1.1)
|
39
62
|
ast (~> 2.4.1)
|
40
63
|
public_suffix (4.0.6)
|
41
64
|
rainbow (3.0.0)
|
42
|
-
rake (
|
65
|
+
rake (13.0.6)
|
43
66
|
rexml (3.2.5)
|
44
67
|
rspec (3.10.0)
|
45
68
|
rspec-core (~> 3.10.0)
|
@@ -67,22 +90,26 @@ GEM
|
|
67
90
|
rubocop-rspec (1.39.0)
|
68
91
|
rubocop (>= 0.68.1)
|
69
92
|
ruby-progressbar (1.11.0)
|
70
|
-
ruby2_keywords (0.0.
|
93
|
+
ruby2_keywords (0.0.5)
|
71
94
|
timecop (0.9.4)
|
95
|
+
tzinfo (2.0.4)
|
96
|
+
concurrent-ruby (~> 1.0)
|
72
97
|
unicode-display_width (1.7.0)
|
73
98
|
vcr (6.0.0)
|
74
99
|
webmock (3.13.0)
|
75
100
|
addressable (>= 2.3.6)
|
76
101
|
crack (>= 0.3.2)
|
77
102
|
hashdiff (>= 0.4.0, < 2.0.0)
|
103
|
+
zeitwerk (2.5.4)
|
78
104
|
|
79
105
|
PLATFORMS
|
80
106
|
arm64-darwin-20
|
107
|
+
ruby
|
81
108
|
x86_64-linux
|
82
109
|
|
83
110
|
DEPENDENCIES
|
84
111
|
notion-ruby-client!
|
85
|
-
rake (~>
|
112
|
+
rake (~> 13)
|
86
113
|
rspec
|
87
114
|
rubocop (~> 0.82.0)
|
88
115
|
rubocop-performance (~> 1.5.2)
|