notion-ruby-client 1.1.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +91 -0
- data/lib/notion/api/endpoints/comments.rb +61 -0
- data/lib/notion/api/endpoints/pages.rb +4 -1
- data/lib/notion/api/endpoints.rb +2 -0
- data/lib/notion/version.rb +1 -1
- data/spec/fixtures/notion/create_discussion_comment.yml +110 -0
- data/spec/fixtures/notion/create_page_comment.yml +110 -0
- data/spec/fixtures/notion/create_page_with_parent_page.yml +128 -0
- data/spec/fixtures/notion/retrieve_comments.yml +106 -0
- data/spec/notion/api/endpoints/comments_spec.rb +49 -0
- data/spec/notion/api/endpoints/pages_spec.rb +41 -0
- metadata +13 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8efd1d425881a003b3c1260955894754f4e9715c94351b3f626a274bd480b84f
|
4
|
+
data.tar.gz: 56dd489369c6920beb24de71efa8bf87a947ad6759d97d5b00354eab1e428bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f7c5bdfd8b31ba2715c72868df79bb0bda240c7a57a5bc499d643cf871fd71ee5243cdf92838ff4f6af3ef65de641d1803bcc4550d7b158f3ed3823d844edf2
|
7
|
+
data.tar.gz: d95c91aac3fa0e04529851a144ce21e3e28be1d9a03bcf4091b4970d81a3d6949a1b9cb396dd7aaaf6c2ffa18ebae29056acc8ce8abfca974c768d2feb206b3c
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
### 1.2.1 (2023-02-26)
|
2
|
+
|
3
|
+
#### New
|
4
|
+
|
5
|
+
- Add support for creating a page as child of another page (thanks @TABeauchat!)
|
6
|
+
|
7
|
+
### 1.2.0 (2023-02-26)
|
8
|
+
|
9
|
+
#### New
|
10
|
+
|
11
|
+
- Add support for the following new endpoints (thanks @themoffatt!):
|
12
|
+
- [Create comment](https://developers.notion.com/reference/create-a-comment)
|
13
|
+
- [Retrieve comments](https://developers.notion.com/reference/retrieve-a-comment)
|
14
|
+
|
1
15
|
### 1.1.0 (2023-02-23)
|
2
16
|
|
3
17
|
#### Breaking changes
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -32,6 +32,10 @@ A Ruby client for the Notion API.
|
|
32
32
|
- [Delete a block](#delete-a-block)
|
33
33
|
- [Retrieve block children](#retrieve-block-children)
|
34
34
|
- [Append block children](#append-block-children)
|
35
|
+
- [Comments](#comments)
|
36
|
+
- [Retrieve comments](#retrieve-comments-from-a-page-or-block-by-id)
|
37
|
+
- [Create a comment on a page](#create-a-comment-on-a-page)
|
38
|
+
- [Create a comment on a discussion](#create-a-comment-on-a-discussion)
|
35
39
|
- [Users](#users)
|
36
40
|
- [Retrieve your token's bot user](#retrieve-your-tokens-bot-user)
|
37
41
|
- [Retrieve a user](#retrieve-a-user)
|
@@ -279,6 +283,8 @@ If the parent is a page, the only valid property is `title`.
|
|
279
283
|
|
280
284
|
The new page may include page content, described as [blocks](https://developers.notion.com/reference-link/block) in the children parameter.
|
281
285
|
|
286
|
+
The following example creates a new page within the specified database:
|
287
|
+
|
282
288
|
```ruby
|
283
289
|
properties = {
|
284
290
|
'Name': {
|
@@ -342,6 +348,54 @@ client.create_page(
|
|
342
348
|
)
|
343
349
|
```
|
344
350
|
|
351
|
+
This example creates a new page as a child of an existing page.
|
352
|
+
|
353
|
+
```ruby
|
354
|
+
properties = {
|
355
|
+
title: [
|
356
|
+
{
|
357
|
+
"type": "text",
|
358
|
+
"text": {
|
359
|
+
"content": "My favorite food",
|
360
|
+
"link": null
|
361
|
+
}
|
362
|
+
}
|
363
|
+
]
|
364
|
+
}
|
365
|
+
children = [
|
366
|
+
{
|
367
|
+
'object': 'block',
|
368
|
+
'type': 'heading_2',
|
369
|
+
'heading_2': {
|
370
|
+
'rich_text': [{
|
371
|
+
'type': 'text',
|
372
|
+
'text': { 'content': 'Lacinato kale' }
|
373
|
+
}]
|
374
|
+
}
|
375
|
+
},
|
376
|
+
{
|
377
|
+
'object': 'block',
|
378
|
+
'type': 'paragraph',
|
379
|
+
'paragraph': {
|
380
|
+
'rich_text': [
|
381
|
+
{
|
382
|
+
'type': 'text',
|
383
|
+
'text': {
|
384
|
+
'content': 'Lacinato kale is a variety of kale with a long tradition in Italian cuisine, especially that of Tuscany. It is also known as Tuscan kale, Italian kale, dinosaur kale, kale, flat back kale, palm tree kale, or black Tuscan palm.',
|
385
|
+
'link': { 'url': 'https://en.wikipedia.org/wiki/Lacinato_kale' }
|
386
|
+
}
|
387
|
+
}
|
388
|
+
]
|
389
|
+
}
|
390
|
+
}
|
391
|
+
]
|
392
|
+
client.create_page(
|
393
|
+
parent: { page_id: 'feb1cdfaab6a43cea4ecbc9e8de63ef7'},
|
394
|
+
properties: properties,
|
395
|
+
children: children
|
396
|
+
)
|
397
|
+
```
|
398
|
+
|
345
399
|
See the full endpoint documentation on [Notion Developers](https://developers.notion.com/reference/post-page).
|
346
400
|
|
347
401
|
#### Update page
|
@@ -463,6 +517,43 @@ client.block_append_children(block_id: 'b55c9c91-384d-452b-81db-d1ef79372b75', c
|
|
463
517
|
|
464
518
|
See the full endpoint documentation on [Notion Developers](https://developers.notion.com/reference/patch-block-children).
|
465
519
|
|
520
|
+
### Comments
|
521
|
+
|
522
|
+
#### Retrieve comments from a page or block by id
|
523
|
+
```ruby
|
524
|
+
client.retrieve_comments(block_id: '1a2f70ab26154dc7a838536a3f430af4')
|
525
|
+
```
|
526
|
+
#### Create a comment on a page
|
527
|
+
```ruby
|
528
|
+
options = {
|
529
|
+
parent: { page_id: '3e4bc91d36c74de595113b31c6fdb82c' },
|
530
|
+
rich_text: [
|
531
|
+
{
|
532
|
+
text: {
|
533
|
+
content: 'Hello world'
|
534
|
+
}
|
535
|
+
}
|
536
|
+
]
|
537
|
+
}
|
538
|
+
client.create_comment(options)
|
539
|
+
```
|
540
|
+
#### Create a comment on a discussion
|
541
|
+
```ruby
|
542
|
+
options = {
|
543
|
+
discussion_id: 'ea116af4839c410bb4ac242a18dc4392',
|
544
|
+
rich_text: [
|
545
|
+
{
|
546
|
+
text: {
|
547
|
+
content: 'Hello world'
|
548
|
+
}
|
549
|
+
}
|
550
|
+
]
|
551
|
+
}
|
552
|
+
client.create_comment(options)
|
553
|
+
```
|
554
|
+
|
555
|
+
See the full endpoint documention on [Notion Developers](https://developers.notion.com/reference/comment-object).
|
556
|
+
|
466
557
|
### Users
|
467
558
|
|
468
559
|
#### Retrieve your token's bot user
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Api
|
4
|
+
module Endpoints
|
5
|
+
module Comments
|
6
|
+
#
|
7
|
+
# Retrieves a list of un-resolved Comment objects from a page or block.
|
8
|
+
#
|
9
|
+
# @option options [id] :block_id
|
10
|
+
# Block or page id to fetch comments for.
|
11
|
+
#
|
12
|
+
# @option options [start_cursor] :start_cursor
|
13
|
+
# If supplied, this endpoint will return a page
|
14
|
+
# of results starting after the cursor provided.
|
15
|
+
# If not supplied, this endpoint will return the
|
16
|
+
# first page of results.
|
17
|
+
#
|
18
|
+
# @option options [page_size] :page_size
|
19
|
+
# The number of items from the full list desired in the response.
|
20
|
+
# Maximum: 100
|
21
|
+
#
|
22
|
+
def retrieve_comments(options = {})
|
23
|
+
throw ArgumentError.new('Required arguments :block_id missing') if options[:block_id].nil?
|
24
|
+
if block_given?
|
25
|
+
Pagination::Cursor.new(self, :retrieve_comments, options).each do |page|
|
26
|
+
yield page
|
27
|
+
end
|
28
|
+
else
|
29
|
+
get('comments', options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Creates a comment in a page or existing discussion thread.
|
35
|
+
# There are two locations you can add a new comment to:
|
36
|
+
# - A page
|
37
|
+
# - An existing discussion thread
|
38
|
+
# If the intention is to add a new comment to a page, a parent object
|
39
|
+
# must be provided in the body params. Alternatively, if a new comment
|
40
|
+
# is being added to an existing discussion thread, the discussion_id string
|
41
|
+
# must be provided in the body params. Exactly one of these parameters must be provided.
|
42
|
+
#
|
43
|
+
# @option options [Object] :parent
|
44
|
+
# A page parent. Either this or a discussion_id is required (not both).
|
45
|
+
#
|
46
|
+
# @option options [UUID] :discussion_id
|
47
|
+
# A UUID identifier for a discussion thread. Either this or a parent object is required (not both).
|
48
|
+
#
|
49
|
+
# @option options [Object] :rich_text
|
50
|
+
# A rich text object.
|
51
|
+
def create_comment(options = {})
|
52
|
+
if options.dig(:parent, :page_id).nil? && options[:discussion_id].nil?
|
53
|
+
throw ArgumentError.new('Required argument :page_id or :discussion_id missing')
|
54
|
+
end
|
55
|
+
throw ArgumentError.new('Required argument :rich_text missing') if options[:rich_text].nil?
|
56
|
+
post('comments', options)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -38,7 +38,10 @@ module Notion
|
|
38
38
|
# @option options [Object] :children
|
39
39
|
# An optional array of Block objects representing the Page’s content
|
40
40
|
def create_page(options = {})
|
41
|
-
|
41
|
+
if options.dig(:parent, :database_id).nil? && options.dig(:parent, :page_id).nil?
|
42
|
+
throw ArgumentError.new('Required argument :parent.database_id or :parent.page_id required')
|
43
|
+
end
|
44
|
+
|
42
45
|
post("pages", options)
|
43
46
|
end
|
44
47
|
|
data/lib/notion/api/endpoints.rb
CHANGED
@@ -5,6 +5,7 @@ require_relative 'endpoints/databases'
|
|
5
5
|
require_relative 'endpoints/pages'
|
6
6
|
require_relative 'endpoints/users'
|
7
7
|
require_relative 'endpoints/search'
|
8
|
+
require_relative 'endpoints/comments'
|
8
9
|
|
9
10
|
module Notion
|
10
11
|
module Api
|
@@ -14,6 +15,7 @@ module Notion
|
|
14
15
|
include Pages
|
15
16
|
include Users
|
16
17
|
include Search
|
18
|
+
include Comments
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
data/lib/notion/version.rb
CHANGED
@@ -0,0 +1,110 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.notion.com/v1/comments
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"rich_text":[{"text":{"content":"test comment"}}],"discussion_id":"ea116af4839c410bb4ac242a18dc4392"}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json; charset=utf-8
|
12
|
+
User-Agent:
|
13
|
+
- Notion Ruby Client/1.0.0
|
14
|
+
Authorization:
|
15
|
+
- Bearer <NOTION_API_TOKEN>
|
16
|
+
Notion-Version:
|
17
|
+
- '2022-02-22'
|
18
|
+
Content-Type:
|
19
|
+
- application/json
|
20
|
+
Accept-Encoding:
|
21
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Date:
|
28
|
+
- Fri, 02 Sep 2022 16:29:26 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Set-Cookie:
|
36
|
+
- notion_browser_id=060fba74-6b6c-4d17-bd99-ac0aaa23aefd; Domain=www.notion.so;
|
37
|
+
Path=/; Expires=Sat, 02 Sep 2023 16:29:26 GMT; Secure
|
38
|
+
- notion_check_cookie_consent=false; Domain=www.notion.so; Path=/; Expires=Sat,
|
39
|
+
03 Sep 2022 16:29:26 GMT; Secure
|
40
|
+
Content-Security-Policy:
|
41
|
+
- "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://gist.github.com https://apis.google.com
|
42
|
+
https://www.google.com https://www.gstatic.com https://cdn.amplitude.com https://api.amplitude.com
|
43
|
+
https://hkfxbbdzib.notion.so https://widget.intercom.io https://js.intercomcdn.com
|
44
|
+
https://static.zdassets.com https://api.smooch.io\t https://logs-01.loggly.com
|
45
|
+
https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://analytics.pgncs.notion.so
|
46
|
+
https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com
|
47
|
+
https://embed.typeform.com https://admin.typeform.com https://public.profitwell.com
|
48
|
+
js.sentry-cdn.com https://js.chilipiper.com https://platform.twitter.com https://cdn.syndication.twimg.com
|
49
|
+
https://accounts.google.com www.googletagmanager.com https://www.googleadservices.com
|
50
|
+
https://googleads.g.doubleclick.net https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com
|
51
|
+
https://client.mutinycdn.com https://user-data.mutinycdn.com;connect-src 'self'
|
52
|
+
https://msgstore.www.notion.so wss://msgstore.www.notion.so ws://localhost:*
|
53
|
+
ws://127.0.0.1:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com
|
54
|
+
https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com
|
55
|
+
https://cdn.amplitude.com https://api.amplitude.com https://hkfxbbdzib.notion.so
|
56
|
+
https://www.notion.so https://api.embed.ly https://js.intercomcdn.com https://api-iam.intercom.io
|
57
|
+
https://uploads.intercomcdn.com wss://nexus-websocket-a.intercom.io https://ekr.zdassets.com
|
58
|
+
https://ekr.zendesk.com\t https://makenotion.zendesk.com\t https://api.smooch.io\t
|
59
|
+
wss://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com
|
60
|
+
https://cdn.segment.com https://api.segment.io https://analytics.pgncs.notion.so
|
61
|
+
https://api.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com
|
62
|
+
https://js.stripe.com https://cdn.contentful.com https://preview.contentful.com
|
63
|
+
https://images.ctfassets.net https://www2.profitwell.com https://tracking.chilipiper.com
|
64
|
+
https://api.chilipiper.com https://api.unsplash.com https://boards-api.greenhouse.io
|
65
|
+
https://accounts.google.com https://oauth2.googleapis.com https://www.googleadservices.com
|
66
|
+
https://googleads.g.doubleclick.net https://region1.google-analytics.com https://region1.analytics.google.com
|
67
|
+
https://www.google-analytics.com https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com
|
68
|
+
https://client.mutinycdn.com https://user-data.mutinycdn.com https://api.statuspage.io
|
69
|
+
https://pgncd.notion.so https://api.statsig.com https://statsigapi.net https://exp.notion.so
|
70
|
+
https://file.notion.so;font-src 'self' data: https://cdnjs.cloudflare.com
|
71
|
+
https://js.intercomcdn.com;img-src 'self' data: blob: https: https://platform.twitter.com
|
72
|
+
https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com
|
73
|
+
https://region1.google-analytics.com https://region1.analytics.google.com;style-src
|
74
|
+
'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://github.githubassets.com
|
75
|
+
https://js.chilipiper.com https://platform.twitter.com https://ton.twimg.com
|
76
|
+
https://accounts.google.com;frame-src https: http: https://accounts.google.com;media-src
|
77
|
+
https: http: https://file.notion.so"
|
78
|
+
X-Dns-Prefetch-Control:
|
79
|
+
- 'off'
|
80
|
+
X-Frame-Options:
|
81
|
+
- SAMEORIGIN
|
82
|
+
Strict-Transport-Security:
|
83
|
+
- max-age=5184000; includeSubDomains
|
84
|
+
X-Download-Options:
|
85
|
+
- noopen
|
86
|
+
X-Content-Type-Options:
|
87
|
+
- nosniff
|
88
|
+
X-Permitted-Cross-Domain-Policies:
|
89
|
+
- none
|
90
|
+
Referrer-Policy:
|
91
|
+
- strict-origin-when-cross-origin
|
92
|
+
X-Xss-Protection:
|
93
|
+
- '0'
|
94
|
+
Etag:
|
95
|
+
- W/"250-4FWWLrU/GwY9p/XT7GcTdthccMw"
|
96
|
+
Vary:
|
97
|
+
- Accept-Encoding
|
98
|
+
Cf-Cache-Status:
|
99
|
+
- DYNAMIC
|
100
|
+
Server:
|
101
|
+
- cloudflare
|
102
|
+
Cf-Ray:
|
103
|
+
- 74479fdd5a4e2940-ORD
|
104
|
+
body:
|
105
|
+
encoding: UTF-8
|
106
|
+
string: '{"object":"comment","id":"9e908609-bfcd-42d2-8f54-61c39d82351d","parent":{"type":"block_id","block_id":"1a2f70ab-2615-4dc7-a838-536a3f430af4"},"discussion_id":"ea116af4-839c-410b-b4ac-242a18dc4392","created_time":"2022-09-02T16:29:00.000Z","last_edited_time":"2022-09-02T16:29:00.000Z","created_by":{"object":"user","id":"3eb712e5-c1d7-43f2-ae18-c4d36f846aa1"},"rich_text":[{"type":"text","text":{"content":"test
|
107
|
+
comment","link":null},"annotations":{"bold":false,"italic":false,"strikethrough":false,"underline":false,"code":false,"color":"default"},"plain_text":"test
|
108
|
+
comment","href":null}]}'
|
109
|
+
recorded_at: Fri, 02 Sep 2022 16:29:26 GMT
|
110
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,110 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.notion.com/v1/comments
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"rich_text":[{"text":{"content":"test comment"}}],"parent":{"page_id":"3e4bc91d36c74de595113b31c6fdb82c"}}'
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- application/json; charset=utf-8
|
12
|
+
User-Agent:
|
13
|
+
- Notion Ruby Client/1.0.0
|
14
|
+
Authorization:
|
15
|
+
- Bearer <NOTION_API_TOKEN>
|
16
|
+
Notion-Version:
|
17
|
+
- '2022-02-22'
|
18
|
+
Content-Type:
|
19
|
+
- application/json
|
20
|
+
Accept-Encoding:
|
21
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Date:
|
28
|
+
- Fri, 02 Sep 2022 16:26:31 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json; charset=utf-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Set-Cookie:
|
36
|
+
- notion_browser_id=fd495a20-5f77-4a87-a210-adb2144bd55b; Domain=www.notion.so;
|
37
|
+
Path=/; Expires=Sat, 02 Sep 2023 16:26:31 GMT; Secure
|
38
|
+
- notion_check_cookie_consent=false; Domain=www.notion.so; Path=/; Expires=Sat,
|
39
|
+
03 Sep 2022 16:26:31 GMT; Secure
|
40
|
+
Content-Security-Policy:
|
41
|
+
- "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://gist.github.com https://apis.google.com
|
42
|
+
https://www.google.com https://www.gstatic.com https://cdn.amplitude.com https://api.amplitude.com
|
43
|
+
https://hkfxbbdzib.notion.so https://widget.intercom.io https://js.intercomcdn.com
|
44
|
+
https://static.zdassets.com https://api.smooch.io\t https://logs-01.loggly.com
|
45
|
+
https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://analytics.pgncs.notion.so
|
46
|
+
https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com
|
47
|
+
https://embed.typeform.com https://admin.typeform.com https://public.profitwell.com
|
48
|
+
js.sentry-cdn.com https://js.chilipiper.com https://platform.twitter.com https://cdn.syndication.twimg.com
|
49
|
+
https://accounts.google.com www.googletagmanager.com https://www.googleadservices.com
|
50
|
+
https://googleads.g.doubleclick.net https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com
|
51
|
+
https://client.mutinycdn.com https://user-data.mutinycdn.com;connect-src 'self'
|
52
|
+
https://msgstore.www.notion.so wss://msgstore.www.notion.so ws://localhost:*
|
53
|
+
ws://127.0.0.1:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com
|
54
|
+
https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com
|
55
|
+
https://cdn.amplitude.com https://api.amplitude.com https://hkfxbbdzib.notion.so
|
56
|
+
https://www.notion.so https://api.embed.ly https://js.intercomcdn.com https://api-iam.intercom.io
|
57
|
+
https://uploads.intercomcdn.com wss://nexus-websocket-a.intercom.io https://ekr.zdassets.com
|
58
|
+
https://ekr.zendesk.com\t https://makenotion.zendesk.com\t https://api.smooch.io\t
|
59
|
+
wss://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com
|
60
|
+
https://cdn.segment.com https://api.segment.io https://analytics.pgncs.notion.so
|
61
|
+
https://api.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com
|
62
|
+
https://js.stripe.com https://cdn.contentful.com https://preview.contentful.com
|
63
|
+
https://images.ctfassets.net https://www2.profitwell.com https://tracking.chilipiper.com
|
64
|
+
https://api.chilipiper.com https://api.unsplash.com https://boards-api.greenhouse.io
|
65
|
+
https://accounts.google.com https://oauth2.googleapis.com https://www.googleadservices.com
|
66
|
+
https://googleads.g.doubleclick.net https://region1.google-analytics.com https://region1.analytics.google.com
|
67
|
+
https://www.google-analytics.com https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com
|
68
|
+
https://client.mutinycdn.com https://user-data.mutinycdn.com https://api.statuspage.io
|
69
|
+
https://pgncd.notion.so https://api.statsig.com https://statsigapi.net https://exp.notion.so
|
70
|
+
https://file.notion.so;font-src 'self' data: https://cdnjs.cloudflare.com
|
71
|
+
https://js.intercomcdn.com;img-src 'self' data: blob: https: https://platform.twitter.com
|
72
|
+
https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com
|
73
|
+
https://region1.google-analytics.com https://region1.analytics.google.com;style-src
|
74
|
+
'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://github.githubassets.com
|
75
|
+
https://js.chilipiper.com https://platform.twitter.com https://ton.twimg.com
|
76
|
+
https://accounts.google.com;frame-src https: http: https://accounts.google.com;media-src
|
77
|
+
https: http: https://file.notion.so"
|
78
|
+
X-Dns-Prefetch-Control:
|
79
|
+
- 'off'
|
80
|
+
X-Frame-Options:
|
81
|
+
- SAMEORIGIN
|
82
|
+
Strict-Transport-Security:
|
83
|
+
- max-age=5184000; includeSubDomains
|
84
|
+
X-Download-Options:
|
85
|
+
- noopen
|
86
|
+
X-Content-Type-Options:
|
87
|
+
- nosniff
|
88
|
+
X-Permitted-Cross-Domain-Policies:
|
89
|
+
- none
|
90
|
+
Referrer-Policy:
|
91
|
+
- strict-origin-when-cross-origin
|
92
|
+
X-Xss-Protection:
|
93
|
+
- '0'
|
94
|
+
Etag:
|
95
|
+
- W/"24e-lwOvl3pLRgq3uaVwDU7YNYGeauA"
|
96
|
+
Vary:
|
97
|
+
- Accept-Encoding
|
98
|
+
Cf-Cache-Status:
|
99
|
+
- DYNAMIC
|
100
|
+
Server:
|
101
|
+
- cloudflare
|
102
|
+
Cf-Ray:
|
103
|
+
- 74479b9bdc202d94-ORD
|
104
|
+
body:
|
105
|
+
encoding: UTF-8
|
106
|
+
string: '{"object":"comment","id":"95ef4675-e3c0-428c-b937-ac8d6805ac04","parent":{"type":"page_id","page_id":"3e4bc91d-36c7-4de5-9511-3b31c6fdb82c"},"discussion_id":"4cbe01af-8163-4b03-957d-cac2691b9839","created_time":"2022-09-02T16:26:00.000Z","last_edited_time":"2022-09-02T16:26:00.000Z","created_by":{"object":"user","id":"3eb712e5-c1d7-43f2-ae18-c4d36f846aa1"},"rich_text":[{"type":"text","text":{"content":"test
|
107
|
+
comment","link":null},"annotations":{"bold":false,"italic":false,"strikethrough":false,"underline":false,"code":false,"color":"default"},"plain_text":"test
|
108
|
+
comment","href":null}]}'
|
109
|
+
recorded_at: Fri, 02 Sep 2022 16:26:31 GMT
|
110
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,128 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.notion.com/v1/pages
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"parent":{"page_id":"0593a719ff2e44aaa14a2bf169429284"},"properties":{"title":[{"text":{"content":"Another
|
9
|
+
Notion page"}}]},"children":[{"object":"block","type":"heading_2","heading_2":{"rich_text":[{"type":"text","text":{"content":"My
|
10
|
+
Heading 2"}}]}}]}'
|
11
|
+
headers:
|
12
|
+
Accept:
|
13
|
+
- application/json; charset=utf-8
|
14
|
+
User-Agent:
|
15
|
+
- Notion Ruby Client/1.2.0
|
16
|
+
Authorization:
|
17
|
+
- Bearer <NOTION_API_TOKEN>
|
18
|
+
Notion-Version:
|
19
|
+
- '2022-02-22'
|
20
|
+
Content-Type:
|
21
|
+
- application/json
|
22
|
+
Accept-Encoding:
|
23
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 200
|
27
|
+
message: OK
|
28
|
+
headers:
|
29
|
+
Date:
|
30
|
+
- Sun, 26 Feb 2023 17:21:54 GMT
|
31
|
+
Content-Type:
|
32
|
+
- application/json; charset=utf-8
|
33
|
+
Transfer-Encoding:
|
34
|
+
- chunked
|
35
|
+
Connection:
|
36
|
+
- keep-alive
|
37
|
+
Set-Cookie:
|
38
|
+
- __cf_bm=3uGTzmXnS9NSPlzB6MC25WX5a50pZafwabcoIG1k3mg-1677432114-0-AcTcZQhFHvWa2oYDeQ8RwgCXQcgn4zIPacEQnLYxg9MB0SGg74A/jZJePnsEBSNvZvZk9t9E1pL0T1zkr/KLHZE=;
|
39
|
+
path=/; expires=Sun, 26-Feb-23 17:51:54 GMT; domain=.notion.com; HttpOnly;
|
40
|
+
Secure; SameSite=None
|
41
|
+
- notion_browser_id=1d39e7da-f4cd-4161-ac33-b489ee848b04; Domain=www.notion.so;
|
42
|
+
Path=/; Expires=Mon, 26 Feb 2024 17:21:53 GMT; Secure
|
43
|
+
- notion_check_cookie_consent=false; Domain=www.notion.so; Path=/; Expires=Mon,
|
44
|
+
27 Feb 2023 17:21:53 GMT; Secure
|
45
|
+
Content-Security-Policy:
|
46
|
+
- "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://gist.github.com https://apis.google.com
|
47
|
+
https://www.google.com https://www.gstatic.com https://cdn.amplitude.com https://api.amplitude.com
|
48
|
+
http://dev-embed.notion.co http://embed.notion.co https://widget.intercom.io
|
49
|
+
https://js.intercomcdn.com https://static.zdassets.com https://api.smooch.io\t
|
50
|
+
https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com https://cdn.segment.com
|
51
|
+
https://analytics.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com
|
52
|
+
https://js.stripe.com https://embed.typeform.com https://admin.typeform.com
|
53
|
+
https://public.profitwell.com https://static.profitwell.com js.sentry-cdn.com
|
54
|
+
https://js.chilipiper.com https://platform.twitter.com https://cdn.syndication.twimg.com
|
55
|
+
https://accounts.google.com https://www.googletagmanager.com https://www.googleadservices.com
|
56
|
+
https://googleads.g.doubleclick.net https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com
|
57
|
+
https://client.mutinycdn.com https://user-data.mutinycdn.com https://cdn.metadata.io
|
58
|
+
https://platformapi.metadata.io https://d2hrivdxn8ekm8.cloudfront.net https://d1lu3pmaz2ilpx.cloudfront.net
|
59
|
+
https://dvqigh9b7wa32.cloudfront.net https://d330aiyvva2oww.cloudfront.net
|
60
|
+
https://cdn.transcend.io https://cdn01.boxcdn.net https://cdn.sprig.com assets.customer.io
|
61
|
+
code.gist.build;connect-src 'self' data: blob: https://msgstore.www.notion.so
|
62
|
+
wss://msgstore.www.notion.so ws://localhost:* ws://127.0.0.1:* https://notion-emojis.s3-us-west-2.amazonaws.com
|
63
|
+
https://s3-us-west-2.amazonaws.com https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com
|
64
|
+
https://cdn.amplitude.com https://api.amplitude.com https://www.notion.so
|
65
|
+
https://api.embed.ly http://dev-embed.notion.co http://embed.notion.co https://js.intercomcdn.com
|
66
|
+
https://api-iam.intercom.io https://uploads.intercomcdn.com wss://nexus-websocket-a.intercom.io
|
67
|
+
https://ekr.zdassets.com https://ekr.zendesk.com\t https://makenotion.zendesk.com\t
|
68
|
+
https://api.smooch.io\t wss://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com
|
69
|
+
https://cdn.segment.com https://api.segment.io https://analytics.pgncs.notion.so
|
70
|
+
https://api.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com
|
71
|
+
https://js.stripe.com https://cdn.contentful.com https://preview.contentful.com
|
72
|
+
https://images.ctfassets.net https://www2.profitwell.com https://tracking.chilipiper.com
|
73
|
+
https://api.chilipiper.com https://api.unsplash.com https://boards-api.greenhouse.io
|
74
|
+
https://accounts.google.com https://oauth2.googleapis.com https://www.googletagmanager.com
|
75
|
+
https://analytics.google.com https://www.googleadservices.com https://googleads.g.doubleclick.net
|
76
|
+
https://region1.google-analytics.com https://region1.analytics.google.com
|
77
|
+
https://www.google-analytics.com https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com
|
78
|
+
https://client.mutinycdn.com https://user-data.mutinycdn.com https://cdn.metadata.io
|
79
|
+
https://platformapi.metadata.io https://d2hrivdxn8ekm8.cloudfront.net https://d1lu3pmaz2ilpx.cloudfront.net
|
80
|
+
https://dvqigh9b7wa32.cloudfront.net https://d330aiyvva2oww.cloudfront.net
|
81
|
+
https://cdn.transcend.io https://telemetry.transcend.io https://api.statuspage.io
|
82
|
+
https://pgncd.notion.so https://api.statsig.com https://statsigapi.net https://exp.notion.so
|
83
|
+
https://file.notion.so notion://file.notion.so https://api.box.com https://*.mux.com
|
84
|
+
https://api.sprig.com https://storage.googleapis.com https://cdn.sprig.com
|
85
|
+
https://cdn.userleap.com track.customer.io *.api.gist.build *.cloud.gist.build;font-src
|
86
|
+
'self' data: https://cdnjs.cloudflare.com https://js.intercomcdn.com https://cdn01.boxcdn.net;img-src
|
87
|
+
'self' data: blob: https: https://platform.twitter.com https://syndication.twitter.com
|
88
|
+
https://pbs.twimg.com https://ton.twimg.com https://region1.google-analytics.com
|
89
|
+
https://region1.analytics.google.com https://file.notion.so notion://file.notion.so
|
90
|
+
https://*.mux.com track.customer.io;style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com
|
91
|
+
https://github.githubassets.com https://js.chilipiper.com https://platform.twitter.com
|
92
|
+
https://ton.twimg.com https://accounts.google.com https://cdn.transcend.io
|
93
|
+
https://cdn01.boxcdn.net code.gist.build;media-src blob: https: http: https://file.notion.so
|
94
|
+
notion://file.notion.so https://*.mux.com;worker-src blob:;frame-src https:
|
95
|
+
http: https://accounts.google.com renderer.gist.build code.gist.build"
|
96
|
+
X-Dns-Prefetch-Control:
|
97
|
+
- 'off'
|
98
|
+
X-Frame-Options:
|
99
|
+
- SAMEORIGIN
|
100
|
+
Strict-Transport-Security:
|
101
|
+
- max-age=5184000; includeSubDomains
|
102
|
+
X-Download-Options:
|
103
|
+
- noopen
|
104
|
+
X-Content-Type-Options:
|
105
|
+
- nosniff
|
106
|
+
X-Permitted-Cross-Domain-Policies:
|
107
|
+
- none
|
108
|
+
Referrer-Policy:
|
109
|
+
- strict-origin-when-cross-origin
|
110
|
+
X-Xss-Protection:
|
111
|
+
- '0'
|
112
|
+
Etag:
|
113
|
+
- W/"31f-hsLSu/ULQ6imEDuQTPedr2r+doc"
|
114
|
+
Vary:
|
115
|
+
- Accept-Encoding
|
116
|
+
Cf-Cache-Status:
|
117
|
+
- DYNAMIC
|
118
|
+
Server:
|
119
|
+
- cloudflare
|
120
|
+
Cf-Ray:
|
121
|
+
- 79fa5c17e98d82f8-IAD
|
122
|
+
body:
|
123
|
+
encoding: UTF-8
|
124
|
+
string: '{"object":"page","id":"c40d2199-e67f-4e07-875d-29f6259e7101","created_time":"2023-02-26T17:21:00.000Z","last_edited_time":"2023-02-26T17:21:00.000Z","created_by":{"object":"user","id":"baa602ec-7138-420d-bce4-a7c6cf125aa4"},"last_edited_by":{"object":"user","id":"baa602ec-7138-420d-bce4-a7c6cf125aa4"},"cover":null,"icon":null,"parent":{"type":"page_id","page_id":"0593a719-ff2e-44aa-a14a-2bf169429284"},"archived":false,"properties":{"title":{"id":"title","type":"title","title":[{"type":"text","text":{"content":"Another
|
125
|
+
Notion page","link":null},"annotations":{"bold":false,"italic":false,"strikethrough":false,"underline":false,"code":false,"color":"default"},"plain_text":"Another
|
126
|
+
Notion page","href":null}]}},"url":"https://www.notion.so/Another-Notion-page-c40d2199e67f4e07875d29f6259e7101"}'
|
127
|
+
recorded_at: Sun, 26 Feb 2023 17:21:54 GMT
|
128
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,106 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.notion.com/v1/comments?block_id=1a2f70ab26154dc7a838536a3f430af4
|
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/1.0.0
|
14
|
+
Authorization:
|
15
|
+
- Bearer <NOTION_API_TOKEN>
|
16
|
+
Notion-Version:
|
17
|
+
- '2022-02-22'
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Fri, 02 Sep 2022 16:21:51 GMT
|
27
|
+
Content-Type:
|
28
|
+
- application/json; charset=utf-8
|
29
|
+
Transfer-Encoding:
|
30
|
+
- chunked
|
31
|
+
Connection:
|
32
|
+
- keep-alive
|
33
|
+
Set-Cookie:
|
34
|
+
- notion_browser_id=86d25b85-2df9-4e71-abd7-1d3e0b02bc8a; Domain=www.notion.so;
|
35
|
+
Path=/; Expires=Sat, 02 Sep 2023 16:21:51 GMT; Secure
|
36
|
+
- notion_check_cookie_consent=false; Domain=www.notion.so; Path=/; Expires=Sat,
|
37
|
+
03 Sep 2022 16:21:51 GMT; Secure
|
38
|
+
Content-Security-Policy:
|
39
|
+
- "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://gist.github.com https://apis.google.com
|
40
|
+
https://www.google.com https://www.gstatic.com https://cdn.amplitude.com https://api.amplitude.com
|
41
|
+
https://hkfxbbdzib.notion.so https://widget.intercom.io https://js.intercomcdn.com
|
42
|
+
https://static.zdassets.com https://api.smooch.io\t https://logs-01.loggly.com
|
43
|
+
https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://analytics.pgncs.notion.so
|
44
|
+
https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com
|
45
|
+
https://embed.typeform.com https://admin.typeform.com https://public.profitwell.com
|
46
|
+
js.sentry-cdn.com https://js.chilipiper.com https://platform.twitter.com https://cdn.syndication.twimg.com
|
47
|
+
https://accounts.google.com www.googletagmanager.com https://www.googleadservices.com
|
48
|
+
https://googleads.g.doubleclick.net https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com
|
49
|
+
https://client.mutinycdn.com https://user-data.mutinycdn.com;connect-src 'self'
|
50
|
+
https://msgstore.www.notion.so wss://msgstore.www.notion.so ws://localhost:*
|
51
|
+
ws://127.0.0.1:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com
|
52
|
+
https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com
|
53
|
+
https://cdn.amplitude.com https://api.amplitude.com https://hkfxbbdzib.notion.so
|
54
|
+
https://www.notion.so https://api.embed.ly https://js.intercomcdn.com https://api-iam.intercom.io
|
55
|
+
https://uploads.intercomcdn.com wss://nexus-websocket-a.intercom.io https://ekr.zdassets.com
|
56
|
+
https://ekr.zendesk.com\t https://makenotion.zendesk.com\t https://api.smooch.io\t
|
57
|
+
wss://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com
|
58
|
+
https://cdn.segment.com https://api.segment.io https://analytics.pgncs.notion.so
|
59
|
+
https://api.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com
|
60
|
+
https://js.stripe.com https://cdn.contentful.com https://preview.contentful.com
|
61
|
+
https://images.ctfassets.net https://www2.profitwell.com https://tracking.chilipiper.com
|
62
|
+
https://api.chilipiper.com https://api.unsplash.com https://boards-api.greenhouse.io
|
63
|
+
https://accounts.google.com https://oauth2.googleapis.com https://www.googleadservices.com
|
64
|
+
https://googleads.g.doubleclick.net https://region1.google-analytics.com https://region1.analytics.google.com
|
65
|
+
https://www.google-analytics.com https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com
|
66
|
+
https://client.mutinycdn.com https://user-data.mutinycdn.com https://api.statuspage.io
|
67
|
+
https://pgncd.notion.so https://api.statsig.com https://statsigapi.net https://exp.notion.so
|
68
|
+
https://file.notion.so;font-src 'self' data: https://cdnjs.cloudflare.com
|
69
|
+
https://js.intercomcdn.com;img-src 'self' data: blob: https: https://platform.twitter.com
|
70
|
+
https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com
|
71
|
+
https://region1.google-analytics.com https://region1.analytics.google.com;style-src
|
72
|
+
'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://github.githubassets.com
|
73
|
+
https://js.chilipiper.com https://platform.twitter.com https://ton.twimg.com
|
74
|
+
https://accounts.google.com;frame-src https: http: https://accounts.google.com;media-src
|
75
|
+
https: http: https://file.notion.so"
|
76
|
+
X-Dns-Prefetch-Control:
|
77
|
+
- 'off'
|
78
|
+
X-Frame-Options:
|
79
|
+
- SAMEORIGIN
|
80
|
+
Strict-Transport-Security:
|
81
|
+
- max-age=5184000; includeSubDomains
|
82
|
+
X-Download-Options:
|
83
|
+
- noopen
|
84
|
+
X-Content-Type-Options:
|
85
|
+
- nosniff
|
86
|
+
X-Permitted-Cross-Domain-Policies:
|
87
|
+
- none
|
88
|
+
Referrer-Policy:
|
89
|
+
- strict-origin-when-cross-origin
|
90
|
+
X-Xss-Protection:
|
91
|
+
- '0'
|
92
|
+
Etag:
|
93
|
+
- W/"2a4-a2pWQq0rrllNzewHfiDfmBJ/vB8"
|
94
|
+
Vary:
|
95
|
+
- Accept-Encoding
|
96
|
+
Cf-Cache-Status:
|
97
|
+
- DYNAMIC
|
98
|
+
Server:
|
99
|
+
- cloudflare
|
100
|
+
Cf-Ray:
|
101
|
+
- 744794c32dac2c80-ORD
|
102
|
+
body:
|
103
|
+
encoding: UTF-8
|
104
|
+
string: '{"object":"list","results":[{"object":"comment","id":"8539f829-54f8-4389-a4a3-a6bc3d40636a","parent":{"type":"block_id","block_id":"1a2f70ab-2615-4dc7-a838-536a3f430af4"},"discussion_id":"ea116af4-839c-410b-b4ac-242a18dc4392","created_time":"2022-09-02T16:19:00.000Z","last_edited_time":"2022-09-02T16:19:00.000Z","created_by":{"object":"user","id":"240574f5-3adc-498c-a504-7733b0ea337b"},"rich_text":[{"type":"text","text":{"content":"hello!","link":null},"annotations":{"bold":false,"italic":false,"strikethrough":false,"underline":false,"code":false,"color":"default"},"plain_text":"hello!","href":null}]}],"next_cursor":null,"has_more":false,"type":"comment","comment":{}}'
|
105
|
+
recorded_at: Fri, 02 Sep 2022 16:21:51 GMT
|
106
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
RSpec.describe Notion::Api::Endpoints::Comments do
|
5
|
+
let(:client) { Notion::Client.new }
|
6
|
+
let(:discussion_comment) do
|
7
|
+
{
|
8
|
+
discussion_id: 'ea116af4839c410bb4ac242a18dc4392',
|
9
|
+
rich_text: [
|
10
|
+
{
|
11
|
+
text: {
|
12
|
+
content: 'test comment'
|
13
|
+
}
|
14
|
+
}
|
15
|
+
]
|
16
|
+
}
|
17
|
+
end
|
18
|
+
let(:page_comment) do
|
19
|
+
{
|
20
|
+
parent: { page_id: '3e4bc91d36c74de595113b31c6fdb82c' },
|
21
|
+
rich_text: [
|
22
|
+
{
|
23
|
+
text: {
|
24
|
+
content: 'test comment'
|
25
|
+
}
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#retrieve_comments' do
|
32
|
+
it 'retrieves comments', vcr: { cassette_name: 'retrieve_comments' } do
|
33
|
+
response = client.retrieve_comments(block_id: '1a2f70ab26154dc7a838536a3f430af4')
|
34
|
+
expect(response.results.size).to eq 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#create_comment' do
|
39
|
+
it 'creates a comment on a page', vcr: { cassette_name: 'create_page_comment' } do
|
40
|
+
response = client.create_comment(page_comment)
|
41
|
+
expect(response.created_time).not_to be_empty
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'creates a comment on a discussion', vcr: { cassette_name: 'create_discussion_comment' } do
|
45
|
+
response = client.create_comment(discussion_comment)
|
46
|
+
expect(response.created_time).not_to be_empty
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -47,6 +47,47 @@ RSpec.describe Notion::Api::Endpoints::Pages do
|
|
47
47
|
expect(response.properties.Name.title.first.plain_text).to eql 'Another Notion page'
|
48
48
|
end
|
49
49
|
|
50
|
+
context 'when creating under parent page' do
|
51
|
+
let(:parent_page) { '0593a719-ff2e-44aa-a14a-2bf169429284' }
|
52
|
+
let(:properties) do
|
53
|
+
{
|
54
|
+
"title": [
|
55
|
+
{
|
56
|
+
"text": {
|
57
|
+
"content": 'Another Notion page'
|
58
|
+
}
|
59
|
+
}
|
60
|
+
]
|
61
|
+
}
|
62
|
+
end
|
63
|
+
let(:children) do
|
64
|
+
[
|
65
|
+
{
|
66
|
+
"object": 'block',
|
67
|
+
"type": 'heading_2',
|
68
|
+
"heading_2": {
|
69
|
+
rich_text: [
|
70
|
+
{
|
71
|
+
type: 'text',
|
72
|
+
text: { content: 'My Heading 2' }
|
73
|
+
}
|
74
|
+
]
|
75
|
+
}
|
76
|
+
}
|
77
|
+
]
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'creates', vcr: { cassette_name: 'create_page_with_parent_page' } do
|
81
|
+
response = client.create_page(
|
82
|
+
parent: { page_id: parent_page },
|
83
|
+
properties: properties,
|
84
|
+
children: children
|
85
|
+
)
|
86
|
+
expect(response.parent.page_id).to eql parent_page
|
87
|
+
expect(response.properties.title.title.first.plain_text).to eql 'Another Notion page'
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
50
91
|
it 'updates', vcr: { cassette_name: 'update_page' } do
|
51
92
|
properties = {
|
52
93
|
"Name": [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas Goutay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -220,6 +220,7 @@ files:
|
|
220
220
|
- lib/notion.rb
|
221
221
|
- lib/notion/api/endpoints.rb
|
222
222
|
- lib/notion/api/endpoints/blocks.rb
|
223
|
+
- lib/notion/api/endpoints/comments.rb
|
223
224
|
- lib/notion/api/endpoints/databases.rb
|
224
225
|
- lib/notion/api/endpoints/pages.rb
|
225
226
|
- lib/notion/api/endpoints/search.rb
|
@@ -245,7 +246,10 @@ files:
|
|
245
246
|
- spec/fixtures/notion/block_append_children.yml
|
246
247
|
- spec/fixtures/notion/block_children.yml
|
247
248
|
- spec/fixtures/notion/create_database.yml
|
249
|
+
- spec/fixtures/notion/create_discussion_comment.yml
|
248
250
|
- spec/fixtures/notion/create_page.yml
|
251
|
+
- spec/fixtures/notion/create_page_comment.yml
|
252
|
+
- spec/fixtures/notion/create_page_with_parent_page.yml
|
249
253
|
- spec/fixtures/notion/database.yml
|
250
254
|
- spec/fixtures/notion/database_query.yml
|
251
255
|
- spec/fixtures/notion/delete_block.yml
|
@@ -256,6 +260,7 @@ files:
|
|
256
260
|
- spec/fixtures/notion/paginated_databases_list.yml
|
257
261
|
- spec/fixtures/notion/paginated_search.yml
|
258
262
|
- spec/fixtures/notion/paginated_users_list.yml
|
263
|
+
- spec/fixtures/notion/retrieve_comments.yml
|
259
264
|
- spec/fixtures/notion/search.yml
|
260
265
|
- spec/fixtures/notion/search_with_query.yml
|
261
266
|
- spec/fixtures/notion/update_block.yml
|
@@ -265,6 +270,7 @@ files:
|
|
265
270
|
- spec/fixtures/notion/users_list.yml
|
266
271
|
- spec/fixtures/notion/users_me.yml
|
267
272
|
- spec/notion/api/endpoints/blocks_spec.rb
|
273
|
+
- spec/notion/api/endpoints/comments_spec.rb
|
268
274
|
- spec/notion/api/endpoints/databases_spec.rb
|
269
275
|
- spec/notion/api/endpoints/pages_spec.rb
|
270
276
|
- spec/notion/api/endpoints/search_spec.rb
|
@@ -303,7 +309,10 @@ test_files:
|
|
303
309
|
- spec/fixtures/notion/block_append_children.yml
|
304
310
|
- spec/fixtures/notion/block_children.yml
|
305
311
|
- spec/fixtures/notion/create_database.yml
|
312
|
+
- spec/fixtures/notion/create_discussion_comment.yml
|
306
313
|
- spec/fixtures/notion/create_page.yml
|
314
|
+
- spec/fixtures/notion/create_page_comment.yml
|
315
|
+
- spec/fixtures/notion/create_page_with_parent_page.yml
|
307
316
|
- spec/fixtures/notion/database.yml
|
308
317
|
- spec/fixtures/notion/database_query.yml
|
309
318
|
- spec/fixtures/notion/delete_block.yml
|
@@ -314,6 +323,7 @@ test_files:
|
|
314
323
|
- spec/fixtures/notion/paginated_databases_list.yml
|
315
324
|
- spec/fixtures/notion/paginated_search.yml
|
316
325
|
- spec/fixtures/notion/paginated_users_list.yml
|
326
|
+
- spec/fixtures/notion/retrieve_comments.yml
|
317
327
|
- spec/fixtures/notion/search.yml
|
318
328
|
- spec/fixtures/notion/search_with_query.yml
|
319
329
|
- spec/fixtures/notion/update_block.yml
|
@@ -323,6 +333,7 @@ test_files:
|
|
323
333
|
- spec/fixtures/notion/users_list.yml
|
324
334
|
- spec/fixtures/notion/users_me.yml
|
325
335
|
- spec/notion/api/endpoints/blocks_spec.rb
|
336
|
+
- spec/notion/api/endpoints/comments_spec.rb
|
326
337
|
- spec/notion/api/endpoints/databases_spec.rb
|
327
338
|
- spec/notion/api/endpoints/pages_spec.rb
|
328
339
|
- spec/notion/api/endpoints/search_spec.rb
|