notion-ruby-client 0.0.7 → 1.0.0.pre.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +5 -0
  3. data/.devcontainer/boot.sh +1 -0
  4. data/.devcontainer/devcontainer.json +30 -0
  5. data/.github/workflows/ci.yml +1 -0
  6. data/.gitignore +7 -0
  7. data/.rubocop.yml +9 -0
  8. data/CHANGELOG.md +42 -0
  9. data/CONTRIBUTING.md +51 -0
  10. data/Gemfile.lock +39 -12
  11. data/README.md +377 -79
  12. data/bin/console +31 -0
  13. data/lib/notion/api/endpoints/blocks.rb +51 -7
  14. data/lib/notion/api/endpoints/databases.rb +60 -31
  15. data/lib/notion/api/endpoints/pages.rb +25 -8
  16. data/lib/notion/api/endpoints/search.rb +41 -0
  17. data/lib/notion/api/endpoints/users.rb +14 -3
  18. data/lib/notion/api/endpoints.rb +3 -1
  19. data/lib/notion/api/errors/too_many_requests.rb +15 -0
  20. data/lib/notion/api/errors.rb +0 -2
  21. data/lib/notion/config.rb +2 -0
  22. data/lib/notion/pagination/cursor.rb +5 -2
  23. data/lib/notion/version.rb +2 -2
  24. data/lib/notion-ruby-client.rb +2 -0
  25. data/notion-ruby-client.gemspec +4 -2
  26. data/spec/fixtures/notion/block.yml +146 -0
  27. data/spec/fixtures/notion/block_append_children.yml +76 -62
  28. data/spec/fixtures/notion/block_children.yml +80 -65
  29. data/spec/fixtures/notion/create_database.yml +149 -0
  30. data/spec/fixtures/notion/create_page.yml +76 -61
  31. data/spec/fixtures/notion/database.yml +78 -61
  32. data/spec/fixtures/notion/database_query.yml +81 -62
  33. data/spec/fixtures/notion/delete_block.yml +145 -0
  34. data/spec/fixtures/notion/page.yml +78 -61
  35. data/spec/fixtures/notion/page_property_item.yml +143 -0
  36. data/spec/fixtures/notion/paginated_block_children.yml +296 -242
  37. data/spec/fixtures/notion/paginated_database_query.yml +79 -62
  38. data/spec/fixtures/notion/paginated_databases_list.yml +78 -61
  39. data/spec/fixtures/notion/paginated_search.yml +301 -0
  40. data/spec/fixtures/notion/paginated_users_list.yml +143 -130
  41. data/spec/fixtures/notion/search.yml +160 -0
  42. data/spec/fixtures/notion/search_with_query.yml +152 -0
  43. data/spec/fixtures/notion/update_block.yml +148 -0
  44. data/spec/fixtures/notion/update_database.yml +152 -0
  45. data/spec/fixtures/notion/update_page.yml +79 -63
  46. data/spec/fixtures/notion/users.yml +69 -56
  47. data/spec/fixtures/notion/users_list.yml +143 -130
  48. data/spec/fixtures/notion/users_me.yml +144 -0
  49. data/spec/notion/api/endpoints/blocks_spec.rb +44 -12
  50. data/spec/notion/api/endpoints/databases_spec.rb +38 -17
  51. data/spec/notion/api/endpoints/pages_spec.rb +21 -13
  52. data/spec/notion/api/endpoints/search_spec.rb +26 -0
  53. data/spec/notion/api/endpoints/users_spec.rb +9 -4
  54. data/spec/notion/pagination/cursor_spec.rb +126 -0
  55. metadata +73 -19
  56. data/.rspec_status +0 -18
  57. data/notion-ruby-client-0.0.4.gem +0 -0
  58. data/scratchpad.rb +0 -22
  59. data/screenshots/create_notion_bot.png +0 -0
  60. data/spec/fixtures/notion/databases_list.yml +0 -133
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54a7b7076dce99aa2eec8b0ba041d2f1bfbdd1558a2ee94f76fe27112a726405
4
- data.tar.gz: 11b710cf49ae369d53b023278ddfe6fe54f9c5eb4cc0d74922966f0d97f45b7f
3
+ metadata.gz: 79512758dde3ce8092694e5358ede8acdadb47fe58f3f21bed15c6715c4d21a5
4
+ data.tar.gz: 863b240db55feeef22c9578d9519df009fc4010aba3c2d784e757de15b80f2d3
5
5
  SHA512:
6
- metadata.gz: 415e4801fd99af01efe431edd03cef55b27a1436a089a69a3bf3cbb986109a810223736e8cb415dd8e60a4066e476af3e7d5736a5ffeb96002fd599e3bd24e0f
7
- data.tar.gz: a26e034921948f495a28362f4ce392601f02e795ee1eac93fa41100df0781522b6a7488e2957b7b80e1fcaaa629433ba9f95aee7121d8a15abb20596a17e16ff
6
+ metadata.gz: f4705cd8542fc5537df2e4889523a59a7bbaca00b3c190fd6ab0a681c4f8419793f0593f831a96ea4bb4324a2065d9f05decffbba1f01ce0d3df89b8fe82265c
7
+ data.tar.gz: 6ec3e8d68bc0ff75d9c6440800fe118c79884cabf560dd28927e663a38d22c877cb2a14aafa3f2c4eb91361bf69f3f8aab04622faa1d26f281a2c66249a4deaa
@@ -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
+ }
@@ -1,4 +1,5 @@
1
1
  on: [push, pull_request]
2
+ name: Continuous Integration
2
3
  jobs:
3
4
  test:
4
5
  strategy:
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .env
2
+ pkg
3
+ Gemfile.lock
4
+ .DS_Store
5
+ .bundle
6
+ .idea
7
+ .rspec_status
data/.rubocop.yml CHANGED
@@ -35,6 +35,15 @@ RSpec/ExampleLength:
35
35
  RSpec/MultipleExpectations:
36
36
  Enabled: false
37
37
 
38
+ RSpec/FilePath:
39
+ Enabled: false
40
+
41
+ RSpec/MessageSpies:
42
+ Enabled: false
43
+
44
+ RSpec/NestedGroups:
45
+ Max: 5
46
+
38
47
  Style/Documentation:
39
48
  Enabled: false
40
49
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ### 1.0.0-beta1 (2022-03-24)
2
+
3
+ #### New
4
+
5
+ - Add support for the following new endpoints:
6
+ - [Delete a block](https://developers.notion.com/reference/get-block-children)
7
+ - [Retrieve your token's bot user](https://developers.notion.com/reference/get-self)
8
+ - [Retrieve a page property item](https://developers.notion.com/reference/retrieve-a-page-property)
9
+ - Update Notion API Version to `2022-02-22` (thanks @hkob!)
10
+ - Remove the following deprecated endpoint:
11
+ - [List databases](https://developers.notion.com/reference/get-databases)
12
+ - Add Codespaces and CONTRIBUTING.md command for better DX
13
+ - Overhauled documentation
14
+
15
+ #### Upgrade instructions
16
+
17
+ - 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
18
+
19
+ ### 0.1.0-beta1 (2021-08-29)
20
+
21
+ #### New
22
+
23
+ - Add support for the following new endpoints:
24
+ - [Update database](https://developers.notion.com/reference/update-a-database)
25
+ - [Update page](https://developers.notion.com/reference/patch-page)
26
+ - [Retrieve a block](https://developers.notion.com/reference/retrieve-a-block)
27
+ - [Update a block](https://developers.notion.com/reference/update-a-block)
28
+ - [Search](https://developers.notion.com/reference/search)
29
+ - Update Notion API Version to `2021-08-16`
30
+ - Add `bin/console` command for better DX
31
+ - Overhauled documentation
32
+
33
+ #### Upgrade instructions
34
+
35
+ - Please refer to the Notion Changelog to see breaking changes for version `2021-08-16`
36
+ - 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.
37
+
38
+ ### 0.0.8 (2021-07-27)
39
+
40
+ - Bump `Notion-Version` header to `2021-05-13` (@H0R15H0)
41
+ - Add support for the new Create database endpoint (@H0R15H0)
42
+
1
43
  ### 0.0.7 (2021-06-17)
2
44
 
3
45
  - Fixes the query parameter for fetching a page resource
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.6)
4
+ notion-ruby-client (1.0.0.pre.beta1)
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:
12
- addressable (2.7.0)
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)
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
- faraday (1.4.2)
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.1)
24
- multipart-post (>= 1.2, < 3)
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.1.0)
31
- faraday_middleware (1.0.0)
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 (4.1.0)
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 (10.5.0)
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.4)
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 (~> 10)
112
+ rake (~> 13)
86
113
  rspec
87
114
  rubocop (~> 0.82.0)
88
115
  rubocop-performance (~> 1.5.2)