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
@@ -3,17 +3,20 @@ require 'spec_helper'
3
3
 
4
4
  RSpec.describe Notion::Api::Endpoints::Pages do
5
5
  let(:client) { Notion::Client.new }
6
- let(:database_id) { '89b30a70-ce51-4646-ab4f-5fdcb1d5e76c' }
7
- let(:page_id) { '723578f1-6e51-450c-8ee1-09158c19fd4c' }
6
+ let(:database_id) { 'dd428e9d-d3fe-4171-870d-a7a1902c748b' }
7
+ let(:page_id) { 'c7fd1abe-8114-44ea-be77-9632ea33e581' }
8
+ let(:property_id) { '%5BIFC' }
8
9
  let(:properties) do
9
10
  {
10
- "Name": [
11
- {
12
- "text": {
13
- "content": 'Another Notion page'
11
+ "Name": {
12
+ "title": [
13
+ {
14
+ "text": {
15
+ "content": 'Another Notion page'
16
+ }
14
17
  }
15
- }
16
- ]
18
+ ]
19
+ }
17
20
  }
18
21
  end
19
22
  let(:children) do
@@ -30,9 +33,9 @@ RSpec.describe Notion::Api::Endpoints::Pages do
30
33
 
31
34
  context 'pages' do
32
35
  it 'retrieves', vcr: { cassette_name: 'page' } do
33
- response = client.page(id: page_id)
36
+ response = client.page(page_id: page_id)
34
37
  expect(response.properties.Name.type).to eql 'title'
35
- expect(response.properties.Name.title.first.plain_text).to eql 'A Notion page'
38
+ expect(response.properties.Name.title.first.plain_text).to eql 'Nicolas Goutay'
36
39
  end
37
40
 
38
41
  it 'creates', vcr: { cassette_name: 'create_page' } do
@@ -49,16 +52,21 @@ RSpec.describe Notion::Api::Endpoints::Pages do
49
52
  "Name": [
50
53
  {
51
54
  "text": {
52
- "content": 'A Notion page'
55
+ "content": 'Nicolas Goutay'
53
56
  }
54
57
  }
55
58
  ]
56
59
  }
57
60
  response = client.update_page(
58
- id: page_id,
61
+ page_id: page_id,
59
62
  properties: properties
60
63
  )
61
- expect(response.properties.Name.title.first.plain_text).to eql 'A Notion page'
64
+ expect(response.properties.Name.title.first.plain_text).to eql 'Nicolas Goutay'
65
+ end
66
+
67
+ it 'retrieves a page property item', vcr: { cassette_name: 'page_property_item' } do
68
+ response = client.page_property_item(page_id: page_id, property_id: property_id)
69
+ expect(response.email).to eql 'nicolas@orbit.love'
62
70
  end
63
71
  end
64
72
  end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Notion::Api::Endpoints::Search do
5
+ let(:client) { Notion::Client.new }
6
+
7
+ context 'search' do
8
+ it 'searches', vcr: { cassette_name: 'search' } do
9
+ response = client.search
10
+ expect(response.results.size).to eq 2
11
+ end
12
+
13
+ it 'searches with a query', vcr: { cassette_name: 'search_with_query' } do
14
+ response = client.search(query: 'Nicolas')
15
+ expect(response.results.size).to eq 1
16
+ end
17
+
18
+ it 'paginated search', vcr: { cassette_name: 'paginated_search' } do
19
+ results = []
20
+ client.search(page_size: 2) do |page|
21
+ results.concat page.results
22
+ end
23
+ expect(results.size).to eq 2
24
+ end
25
+ end
26
+ end
@@ -5,21 +5,26 @@ RSpec.describe Notion::Api::Endpoints::Users do
5
5
  let(:client) { Notion::Client.new }
6
6
 
7
7
  context 'users' do
8
+ it 'me', vcr: { cassette_name: 'users_me' } do
9
+ response = client.me
10
+ expect(response.name).to eql 'Notion to Orbit'
11
+ end
12
+
8
13
  it 'lists', vcr: { cassette_name: 'users_list' } do
9
14
  response = client.users_list
10
- expect(response.results.size).to be 3
15
+ expect(response.results.size).to be 1
11
16
  end
12
17
 
13
18
  it 'paginated list', vcr: { cassette_name: 'paginated_users_list' } do
14
19
  members = []
15
- client.users_list(limit: 2) do |page|
20
+ client.users_list(page_size: 1) do |page|
16
21
  members.concat page.results
17
22
  end
18
- expect(members.size).to eq 3
23
+ expect(members.size).to eq 1
19
24
  end
20
25
 
21
26
  it 'retrieves', vcr: { cassette_name: 'users' } do
22
- response = client.user(id: 'a8da8d30-c858-4c3d-87ad-3f2d477bd98d')
27
+ response = client.user(user_id: 'a8da8d30-c858-4c3d-87ad-3f2d477bd98d')
23
28
  expect(response.name).to eql 'Nicolas Goutay'
24
29
  end
25
30
  end
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+
4
+ RSpec.describe Notion::Api::Pagination::Cursor do
5
+ let(:client) { Notion::Client.new }
6
+
7
+ context 'default cursor' do
8
+ let(:cursor) { described_class.new(client, 'users_list', {}) }
9
+
10
+ it 'provides a default page_size' do
11
+ expect(client).to receive(:users_list).with(page_size: 100)
12
+ cursor.first
13
+ end
14
+
15
+ it 'handles blank response metadata' do
16
+ expect(client).to receive(:users_list).once.and_return(Notion::Messages::Message.new)
17
+ cursor.to_a
18
+ end
19
+
20
+ it 'handles nil response metadata' do
21
+ expect(client).to(
22
+ receive(:users_list).once.and_return(Notion::Messages::Message.new(response: nil))
23
+ )
24
+ cursor.to_a
25
+ end
26
+
27
+ it 'paginates with a cursor inside response metadata' do
28
+ expect(client).to receive(:users_list).twice.and_return(
29
+ Notion::Messages::Message.new(has_more: true, next_cursor: 'next'),
30
+ Notion::Messages::Message.new
31
+ )
32
+ expect(cursor).not_to receive(:sleep)
33
+ cursor.to_a
34
+ end
35
+
36
+ context 'with rate limiting' do
37
+ let(:error) { Notion::Api::Errors::TooManyRequests.new({}) }
38
+
39
+ context 'with default max retries' do
40
+ it 'sleeps after a TooManyRequestsError' do
41
+ expect(client).to(
42
+ receive(:users_list)
43
+ .with(page_size: 100)
44
+ .ordered
45
+ .and_return(Notion::Messages::Message.new({ has_more: true, next_cursor: 'next' }))
46
+ )
47
+ expect(client).to(
48
+ receive(:users_list).with(page_size: 100, start_cursor: 'next').and_raise(error)
49
+ )
50
+ expect(cursor).to receive(:sleep).once.ordered.with(10)
51
+ expect(client).to(
52
+ receive(:users_list)
53
+ .with(page_size: 100, start_cursor: 'next')
54
+ .ordered
55
+ .and_return(Notion::Messages::Message.new)
56
+ )
57
+ cursor.to_a
58
+ end
59
+ end
60
+
61
+ context 'with a custom max_retries' do
62
+ let(:cursor) { described_class.new(client, 'users_list', max_retries: 4) }
63
+
64
+ it 'raises the error after hitting the max retries' do
65
+ expect(client).to(
66
+ receive(:users_list)
67
+ .with(page_size: 100)
68
+ .and_return(Notion::Messages::Message.new({ has_more: true, next_cursor: 'next' }))
69
+ )
70
+ expect(client).to(
71
+ receive(:users_list).with(page_size: 100, start_cursor: 'next').exactly(5).times.and_raise(error)
72
+ )
73
+ expect(cursor).to receive(:sleep).exactly(4).times.with(10)
74
+ expect { cursor.to_a }.to raise_error(error)
75
+ end
76
+ end
77
+
78
+ context 'with a custom retry_after' do
79
+ let(:cursor) { described_class.new(client, 'users_list', retry_after: 5) }
80
+
81
+ it 'sleeps for retry_after seconds after a TooManyRequestsError' do
82
+ expect(client).to(
83
+ receive(:users_list)
84
+ .with(page_size: 100)
85
+ .ordered
86
+ .and_return(Notion::Messages::Message.new({ has_more: true, next_cursor: 'next' }))
87
+ )
88
+ expect(client).to(
89
+ receive(:users_list).with(page_size: 100, start_cursor: 'next').ordered.and_raise(error)
90
+ )
91
+ expect(cursor).to receive(:sleep).once.ordered.with(5)
92
+ expect(client).to(
93
+ receive(:users_list)
94
+ .with(page_size: 100, start_cursor: 'next')
95
+ .ordered
96
+ .and_return(Notion::Messages::Message.new)
97
+ )
98
+ cursor.to_a
99
+ end
100
+ end
101
+ end
102
+ end
103
+
104
+ context 'with a custom page_size' do
105
+ let(:cursor) { described_class.new(client, 'users_list', page_size: 42) }
106
+
107
+ it 'overrides default page_size' do
108
+ expect(client).to receive(:users_list).with(page_size: 42)
109
+ cursor.first
110
+ end
111
+ end
112
+
113
+ context 'with a custom sleep_interval' do
114
+ let(:cursor) { described_class.new(client, 'users_list', sleep_interval: 3) }
115
+
116
+ it 'sleeps between requests' do
117
+ expect(client).to receive(:users_list).exactly(3).times.and_return(
118
+ Notion::Messages::Message.new(has_more: true, next_cursor: 'next_a'),
119
+ Notion::Messages::Message.new(has_more: true, next_cursor: 'next_b'),
120
+ Notion::Messages::Message.new
121
+ )
122
+ expect(cursor).to receive(:sleep).with(3).twice
123
+ cursor.to_a
124
+ end
125
+ end
126
+ end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notion-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0.pre.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Goutay
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-17 00:00:00.000000000 Z
11
+ date: 2022-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: dotenv
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: faraday
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -42,30 +70,30 @@ dependencies:
42
70
  name: hashie
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - ">="
73
+ - - "~>"
46
74
  - !ruby/object:Gem::Version
47
- version: '0'
75
+ version: '5'
48
76
  type: :runtime
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - ">="
80
+ - - "~>"
53
81
  - !ruby/object:Gem::Version
54
- version: '0'
82
+ version: '5'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rake
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - "~>"
60
88
  - !ruby/object:Gem::Version
61
- version: '10'
89
+ version: '13'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
94
  - - "~>"
67
95
  - !ruby/object:Gem::Version
68
- version: '10'
96
+ version: '13'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rspec
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -164,35 +192,42 @@ dependencies:
164
192
  - - ">="
165
193
  - !ruby/object:Gem::Version
166
194
  version: '0'
167
- description:
195
+ description:
168
196
  email: nicolas@orbit.love
169
197
  executables: []
170
198
  extensions: []
171
199
  extra_rdoc_files: []
172
200
  files:
201
+ - ".devcontainer/Dockerfile"
202
+ - ".devcontainer/boot.sh"
203
+ - ".devcontainer/devcontainer.json"
173
204
  - ".github/workflows/ci.yml"
205
+ - ".gitignore"
174
206
  - ".rspec"
175
- - ".rspec_status"
176
207
  - ".rubocop.yml"
177
208
  - ".rubocop_todo.yml"
178
209
  - CHANGELOG.md
179
210
  - CODE_OF_CONDUCT.md
211
+ - CONTRIBUTING.md
180
212
  - Gemfile
181
213
  - Gemfile.lock
182
214
  - LICENSE.md
183
215
  - README.md
184
216
  - Rakefile
217
+ - bin/console
185
218
  - lib/notion-ruby-client.rb
186
219
  - lib/notion.rb
187
220
  - lib/notion/api/endpoints.rb
188
221
  - lib/notion/api/endpoints/blocks.rb
189
222
  - lib/notion/api/endpoints/databases.rb
190
223
  - lib/notion/api/endpoints/pages.rb
224
+ - lib/notion/api/endpoints/search.rb
191
225
  - lib/notion/api/endpoints/users.rb
192
226
  - lib/notion/api/error.rb
193
227
  - lib/notion/api/errors.rb
194
228
  - lib/notion/api/errors/internal_error.rb
195
229
  - lib/notion/api/errors/notion_error.rb
230
+ - lib/notion/api/errors/too_many_requests.rb
196
231
  - lib/notion/client.rb
197
232
  - lib/notion/config.rb
198
233
  - lib/notion/faraday/connection.rb
@@ -204,29 +239,37 @@ files:
204
239
  - lib/notion/pagination/cursor.rb
205
240
  - lib/notion/version.rb
206
241
  - lib/notion_ruby_client.rb
207
- - notion-ruby-client-0.0.4.gem
208
242
  - notion-ruby-client.gemspec
209
- - scratchpad.rb
210
- - screenshots/create_notion_bot.png
243
+ - spec/fixtures/notion/block.yml
211
244
  - spec/fixtures/notion/block_append_children.yml
212
245
  - spec/fixtures/notion/block_children.yml
246
+ - spec/fixtures/notion/create_database.yml
213
247
  - spec/fixtures/notion/create_page.yml
214
248
  - spec/fixtures/notion/database.yml
215
249
  - spec/fixtures/notion/database_query.yml
216
- - spec/fixtures/notion/databases_list.yml
250
+ - spec/fixtures/notion/delete_block.yml
217
251
  - spec/fixtures/notion/page.yml
252
+ - spec/fixtures/notion/page_property_item.yml
218
253
  - spec/fixtures/notion/paginated_block_children.yml
219
254
  - spec/fixtures/notion/paginated_database_query.yml
220
255
  - spec/fixtures/notion/paginated_databases_list.yml
256
+ - spec/fixtures/notion/paginated_search.yml
221
257
  - spec/fixtures/notion/paginated_users_list.yml
258
+ - spec/fixtures/notion/search.yml
259
+ - spec/fixtures/notion/search_with_query.yml
260
+ - spec/fixtures/notion/update_block.yml
261
+ - spec/fixtures/notion/update_database.yml
222
262
  - spec/fixtures/notion/update_page.yml
223
263
  - spec/fixtures/notion/users.yml
224
264
  - spec/fixtures/notion/users_list.yml
265
+ - spec/fixtures/notion/users_me.yml
225
266
  - spec/notion/api/endpoints/blocks_spec.rb
226
267
  - spec/notion/api/endpoints/databases_spec.rb
227
268
  - spec/notion/api/endpoints/pages_spec.rb
269
+ - spec/notion/api/endpoints/search_spec.rb
228
270
  - spec/notion/api/endpoints/users_spec.rb
229
271
  - spec/notion/config_spec.rb
272
+ - spec/notion/pagination/cursor_spec.rb
230
273
  - spec/notion/version_spec.rb
231
274
  - spec/spec_helper.rb
232
275
  - spec/support/token.rb
@@ -235,7 +278,7 @@ homepage: http://github.com/orbit-love/notion-ruby-client
235
278
  licenses:
236
279
  - MIT
237
280
  metadata: {}
238
- post_install_message:
281
+ post_install_message:
239
282
  rdoc_options: []
240
283
  require_paths:
241
284
  - lib
@@ -250,30 +293,41 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
293
  - !ruby/object:Gem::Version
251
294
  version: 1.3.6
252
295
  requirements: []
253
- rubygems_version: 3.2.15
254
- signing_key:
296
+ rubygems_version: 3.1.6
297
+ signing_key:
255
298
  specification_version: 4
256
299
  summary: Notion API client for Ruby.
257
300
  test_files:
301
+ - spec/fixtures/notion/block.yml
258
302
  - spec/fixtures/notion/block_append_children.yml
259
303
  - spec/fixtures/notion/block_children.yml
304
+ - spec/fixtures/notion/create_database.yml
260
305
  - spec/fixtures/notion/create_page.yml
261
306
  - spec/fixtures/notion/database.yml
262
307
  - spec/fixtures/notion/database_query.yml
263
- - spec/fixtures/notion/databases_list.yml
308
+ - spec/fixtures/notion/delete_block.yml
264
309
  - spec/fixtures/notion/page.yml
310
+ - spec/fixtures/notion/page_property_item.yml
265
311
  - spec/fixtures/notion/paginated_block_children.yml
266
312
  - spec/fixtures/notion/paginated_database_query.yml
267
313
  - spec/fixtures/notion/paginated_databases_list.yml
314
+ - spec/fixtures/notion/paginated_search.yml
268
315
  - spec/fixtures/notion/paginated_users_list.yml
316
+ - spec/fixtures/notion/search.yml
317
+ - spec/fixtures/notion/search_with_query.yml
318
+ - spec/fixtures/notion/update_block.yml
319
+ - spec/fixtures/notion/update_database.yml
269
320
  - spec/fixtures/notion/update_page.yml
270
321
  - spec/fixtures/notion/users.yml
271
322
  - spec/fixtures/notion/users_list.yml
323
+ - spec/fixtures/notion/users_me.yml
272
324
  - spec/notion/api/endpoints/blocks_spec.rb
273
325
  - spec/notion/api/endpoints/databases_spec.rb
274
326
  - spec/notion/api/endpoints/pages_spec.rb
327
+ - spec/notion/api/endpoints/search_spec.rb
275
328
  - spec/notion/api/endpoints/users_spec.rb
276
329
  - spec/notion/config_spec.rb
330
+ - spec/notion/pagination/cursor_spec.rb
277
331
  - spec/notion/version_spec.rb
278
332
  - spec/spec_helper.rb
279
333
  - spec/support/token.rb
data/.rspec_status DELETED
@@ -1,18 +0,0 @@
1
- example_id | status | run_time |
2
- ---------------------------------------------------- | ------ | --------------- |
3
- ./spec/notion/api/endpoints/blocks_spec.rb[1:1:1] | passed | 0.01423 seconds |
4
- ./spec/notion/api/endpoints/blocks_spec.rb[1:1:2] | passed | 0.02323 seconds |
5
- ./spec/notion/api/endpoints/blocks_spec.rb[1:1:3] | passed | 0.00704 seconds |
6
- ./spec/notion/api/endpoints/databases_spec.rb[1:1:1] | passed | 0.00598 seconds |
7
- ./spec/notion/api/endpoints/databases_spec.rb[1:1:2] | passed | 0.00628 seconds |
8
- ./spec/notion/api/endpoints/databases_spec.rb[1:1:3] | passed | 0.00548 seconds |
9
- ./spec/notion/api/endpoints/databases_spec.rb[1:1:4] | passed | 0.00596 seconds |
10
- ./spec/notion/api/endpoints/databases_spec.rb[1:1:5] | passed | 0.00606 seconds |
11
- ./spec/notion/api/endpoints/pages_spec.rb[1:1:1] | passed | 0.00581 seconds |
12
- ./spec/notion/api/endpoints/pages_spec.rb[1:1:2] | passed | 0.00598 seconds |
13
- ./spec/notion/api/endpoints/pages_spec.rb[1:1:3] | passed | 0.00717 seconds |
14
- ./spec/notion/api/endpoints/users_spec.rb[1:1:1] | passed | 0.00637 seconds |
15
- ./spec/notion/api/endpoints/users_spec.rb[1:1:2] | passed | 0.00671 seconds |
16
- ./spec/notion/api/endpoints/users_spec.rb[1:1:3] | passed | 0.00567 seconds |
17
- ./spec/notion/config_spec.rb[1:1:1] | passed | 0.00005 seconds |
18
- ./spec/notion/version_spec.rb[1:1] | passed | 0.00005 seconds |
Binary file
data/scratchpad.rb DELETED
@@ -1,22 +0,0 @@
1
- Notion.configure do |config|
2
- config.token = ENV['NOTION_API_TOKEN']
3
- end
4
-
5
- client = Notion::Client.new(token: 'token')
6
-
7
-
8
- client = Notion::Client.new
9
- client.auth_test
10
-
11
- client.database(id)
12
- client.database_query(id, options)
13
-
14
- client.page(id)
15
- client.create_page(options)
16
- client.update_page(id, options)
17
-
18
- client.user(id)
19
- client.list_users(options)
20
-
21
-
22
- # https://c15c8970-daea-4c88-9bcd-93726522a93e.mock.pstmn.io
Binary file
@@ -1,133 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.notion.com/v1/databases
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept:
11
- - application/json; charset=utf-8
12
- User-Agent:
13
- - Notion Ruby Client/0.0.4
14
- Authorization:
15
- - Bearer <NOTION_API_TOKEN>
16
- Accept-Encoding:
17
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
18
- response:
19
- status:
20
- code: 200
21
- message: OK
22
- headers:
23
- Date:
24
- - Sun, 25 Apr 2021 21:00:00 GMT
25
- Content-Type:
26
- - application/json; charset=utf-8
27
- Transfer-Encoding:
28
- - chunked
29
- Connection:
30
- - keep-alive
31
- Set-Cookie:
32
- - __cfduid=ddf6666b47e733887d5b2a492ee98807c1619384400; expires=Tue, 25-May-21
33
- 21:00:00 GMT; path=/; domain=.notion.com; HttpOnly; SameSite=Lax
34
- - notion_browser_id=0f5a0e33-1181-41ca-96bf-22c530d86317; Domain=www.notion.so;
35
- Path=/; Expires=Wed, 01 Jan 2053 22:46:40 GMT; Secure
36
- X-Dns-Prefetch-Control:
37
- - 'off'
38
- X-Frame-Options:
39
- - SAMEORIGIN
40
- Strict-Transport-Security:
41
- - max-age=5184000; includeSubDomains
42
- X-Download-Options:
43
- - noopen
44
- X-Content-Type-Options:
45
- - nosniff
46
- X-Xss-Protection:
47
- - 1; mode=block
48
- Referrer-Policy:
49
- - same-origin
50
- Content-Security-Policy:
51
- - 'script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' https://gist.github.com
52
- https://apis.google.com https://api.amplitude.com https://widget.intercom.io
53
- https://js.intercomcdn.com https://logs-01.loggly.com https://cdn.segment.com
54
- https://analytics.pgncs.notion.so https://checkout.stripe.com https://js.stripe.com/v3
55
- https://embed.typeform.com https://admin.typeform.com https://platform.twitter.com
56
- https://cdn.syndication.twimg.com https://www.googletagmanager.com https://x.clearbitjs.com;
57
- connect-src ''self'' https://msgstore.www.notion.so wss://msgstore.www.notion.so
58
- ws://localhost:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com
59
- https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com
60
- https: http: https://api.amplitude.com https://api.embed.ly https://js.intercomcdn.com
61
- https://api-iam.intercom.io wss://nexus-websocket-a.intercom.io https://logs-01.loggly.com
62
- https://api.segment.io https://api.pgncs.notion.so https://checkout.stripe.com
63
- https://js.stripe.com/v3 https://cdn.contentful.com https://preview.contentful.com
64
- https://images.ctfassets.net https://api.unsplash.com https://boards-api.greenhouse.io;
65
- font-src ''self'' data: https://cdnjs.cloudflare.com https://js.intercomcdn.com;
66
- img-src ''self'' data: blob: https: https://platform.twitter.com https://syndication.twitter.com
67
- https://pbs.twimg.com https://ton.twimg.com www.googletagmanager.com; style-src
68
- ''self'' ''unsafe-inline'' https://cdnjs.cloudflare.com https://github.githubassets.com
69
- https://platform.twitter.com https://ton.twimg.com; frame-src https: http:;
70
- media-src https: http:'
71
- X-Content-Security-Policy:
72
- - 'script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' https://gist.github.com
73
- https://apis.google.com https://api.amplitude.com https://widget.intercom.io
74
- https://js.intercomcdn.com https://logs-01.loggly.com https://cdn.segment.com
75
- https://analytics.pgncs.notion.so https://checkout.stripe.com https://js.stripe.com/v3
76
- https://embed.typeform.com https://admin.typeform.com https://platform.twitter.com
77
- https://cdn.syndication.twimg.com https://www.googletagmanager.com https://x.clearbitjs.com;
78
- connect-src ''self'' https://msgstore.www.notion.so wss://msgstore.www.notion.so
79
- ws://localhost:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com
80
- https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com
81
- https: http: https://api.amplitude.com https://api.embed.ly https://js.intercomcdn.com
82
- https://api-iam.intercom.io wss://nexus-websocket-a.intercom.io https://logs-01.loggly.com
83
- https://api.segment.io https://api.pgncs.notion.so https://checkout.stripe.com
84
- https://js.stripe.com/v3 https://cdn.contentful.com https://preview.contentful.com
85
- https://images.ctfassets.net https://api.unsplash.com https://boards-api.greenhouse.io;
86
- font-src ''self'' data: https://cdnjs.cloudflare.com https://js.intercomcdn.com;
87
- img-src ''self'' data: blob: https: https://platform.twitter.com https://syndication.twitter.com
88
- https://pbs.twimg.com https://ton.twimg.com www.googletagmanager.com; style-src
89
- ''self'' ''unsafe-inline'' https://cdnjs.cloudflare.com https://github.githubassets.com
90
- https://platform.twitter.com https://ton.twimg.com; frame-src https: http:;
91
- media-src https: http:'
92
- X-Webkit-Csp:
93
- - 'script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' https://gist.github.com
94
- https://apis.google.com https://api.amplitude.com https://widget.intercom.io
95
- https://js.intercomcdn.com https://logs-01.loggly.com https://cdn.segment.com
96
- https://analytics.pgncs.notion.so https://checkout.stripe.com https://js.stripe.com/v3
97
- https://embed.typeform.com https://admin.typeform.com https://platform.twitter.com
98
- https://cdn.syndication.twimg.com https://www.googletagmanager.com https://x.clearbitjs.com;
99
- connect-src ''self'' https://msgstore.www.notion.so wss://msgstore.www.notion.so
100
- ws://localhost:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com
101
- https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com
102
- https: http: https://api.amplitude.com https://api.embed.ly https://js.intercomcdn.com
103
- https://api-iam.intercom.io wss://nexus-websocket-a.intercom.io https://logs-01.loggly.com
104
- https://api.segment.io https://api.pgncs.notion.so https://checkout.stripe.com
105
- https://js.stripe.com/v3 https://cdn.contentful.com https://preview.contentful.com
106
- https://images.ctfassets.net https://api.unsplash.com https://boards-api.greenhouse.io;
107
- font-src ''self'' data: https://cdnjs.cloudflare.com https://js.intercomcdn.com;
108
- img-src ''self'' data: blob: https: https://platform.twitter.com https://syndication.twitter.com
109
- https://pbs.twimg.com https://ton.twimg.com www.googletagmanager.com; style-src
110
- ''self'' ''unsafe-inline'' https://cdnjs.cloudflare.com https://github.githubassets.com
111
- https://platform.twitter.com https://ton.twimg.com; frame-src https: http:;
112
- media-src https: http:'
113
- Etag:
114
- - W/"251-eZGSpEiKAHHy9FTpruIlyN5tC1k"
115
- Vary:
116
- - Accept-Encoding
117
- Cf-Cache-Status:
118
- - DYNAMIC
119
- Cf-Request-Id:
120
- - '09ac6e116e00000853a2a59000000001'
121
- Expect-Ct:
122
- - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
123
- Server:
124
- - cloudflare
125
- Cf-Ray:
126
- - 645a7f957fc50853-CDG
127
- body:
128
- encoding: UTF-8
129
- string: '{"object":"list","results":[{"object":"database","id":"89b30a70-ce51-4646-ab4f-5fdcb1d5e76c","created_time":"2021-01-29T20:50:51.917Z","last_edited_time":"2021-04-25T19:59:00.000Z","title":[{"type":"text","text":{"content":"A
130
- Notion database","link":null},"annotations":{"bold":false,"italic":false,"strikethrough":false,"underline":false,"code":false,"color":"default"},"plain_text":"A
131
- Notion database","href":null}],"properties":{"Tags":{"id":"yu]\\","type":"multi_select","multi_select":{"options":[]}},"Name":{"id":"title","type":"title","title":{}}}}],"next_cursor":null,"has_more":false}'
132
- recorded_at: Sun, 25 Apr 2021 21:00:00 GMT
133
- recorded_with: VCR 6.0.0