notion-ruby-client 0.0.4 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,23 @@ require 'spec_helper'
4
4
  RSpec.describe Notion::Api::Endpoints::Databases do
5
5
  let(:client) { Notion::Client.new }
6
6
  let(:database_id) { '89b30a70-ce51-4646-ab4f-5fdcb1d5e76c' }
7
+ let(:page_id) { '7cbf38f8-5921-4422-bd3f-a647c3e2544b' }
8
+ let(:title) do
9
+ [
10
+ {
11
+ "text": {
12
+ "content": 'Another Notion database'
13
+ }
14
+ }
15
+ ]
16
+ end
17
+ let(:properties) do
18
+ {
19
+ "Name": {
20
+ "title": {}
21
+ }
22
+ }
23
+ end
7
24
 
8
25
  context 'databases' do
9
26
  it 'retrieves', vcr: { cassette_name: 'database' } do
@@ -16,6 +33,15 @@ RSpec.describe Notion::Api::Endpoints::Databases do
16
33
  expect(response.results.length).to be >= 1
17
34
  end
18
35
 
36
+ it 'creates', vcr: { cassette_name: 'create_database' } do
37
+ response = client.create_database(
38
+ parent: { page_id: page_id },
39
+ title: title,
40
+ properties: properties
41
+ )
42
+ expect(response.title.first.plain_text).to eql 'Another Notion database'
43
+ end
44
+
19
45
  it 'paginated queries', vcr: { cassette_name: 'paginated_database_query' } do
20
46
  pages = []
21
47
  client.database_query(id: database_id, limit: 1) do |page|
@@ -3,17 +3,28 @@ 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) { 'ab7e7b22-7793-492a-ba6b-3295f8b19341' }
7
+ let(:page_id) { '2de466f0-9861-466b-9bc2-c987965da010' }
8
8
  let(:properties) do
9
9
  {
10
- "Name": [
11
- {
12
- "text": {
13
- "content": 'Another Notion page'
10
+ "Name": {
11
+ "title": [
12
+ {
13
+ "text": {
14
+ "content": 'Another Notion page'
15
+ }
14
16
  }
15
- }
16
- ]
17
+ ]
18
+ },
19
+ "Description": {
20
+ "rich_text": [
21
+ {
22
+ "text": {
23
+ "content": 'Page description'
24
+ }
25
+ }
26
+ ]
27
+ }
17
28
  }
18
29
  end
19
30
  let(:children) do
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: 0.0.4
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas Goutay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-25 00:00:00.000000000 Z
11
+ date: 2021-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -176,6 +176,7 @@ files:
176
176
  - ".rubocop.yml"
177
177
  - ".rubocop_todo.yml"
178
178
  - CHANGELOG.md
179
+ - CODE_OF_CONDUCT.md
179
180
  - Gemfile
180
181
  - Gemfile.lock
181
182
  - LICENSE.md
@@ -184,6 +185,7 @@ files:
184
185
  - lib/notion-ruby-client.rb
185
186
  - lib/notion.rb
186
187
  - lib/notion/api/endpoints.rb
188
+ - lib/notion/api/endpoints/blocks.rb
187
189
  - lib/notion/api/endpoints/databases.rb
188
190
  - lib/notion/api/endpoints/pages.rb
189
191
  - lib/notion/api/endpoints/users.rb
@@ -202,20 +204,26 @@ files:
202
204
  - lib/notion/pagination/cursor.rb
203
205
  - lib/notion/version.rb
204
206
  - lib/notion_ruby_client.rb
207
+ - notion-ruby-client-0.0.4.gem
205
208
  - notion-ruby-client.gemspec
206
209
  - scratchpad.rb
207
210
  - screenshots/create_notion_bot.png
211
+ - spec/fixtures/notion/block_append_children.yml
212
+ - spec/fixtures/notion/block_children.yml
213
+ - spec/fixtures/notion/create_database.yml
208
214
  - spec/fixtures/notion/create_page.yml
209
215
  - spec/fixtures/notion/database.yml
210
216
  - spec/fixtures/notion/database_query.yml
211
217
  - spec/fixtures/notion/databases_list.yml
212
218
  - spec/fixtures/notion/page.yml
219
+ - spec/fixtures/notion/paginated_block_children.yml
213
220
  - spec/fixtures/notion/paginated_database_query.yml
214
221
  - spec/fixtures/notion/paginated_databases_list.yml
215
222
  - spec/fixtures/notion/paginated_users_list.yml
216
223
  - spec/fixtures/notion/update_page.yml
217
224
  - spec/fixtures/notion/users.yml
218
225
  - spec/fixtures/notion/users_list.yml
226
+ - spec/notion/api/endpoints/blocks_spec.rb
219
227
  - spec/notion/api/endpoints/databases_spec.rb
220
228
  - spec/notion/api/endpoints/pages_spec.rb
221
229
  - spec/notion/api/endpoints/users_spec.rb
@@ -248,17 +256,22 @@ signing_key:
248
256
  specification_version: 4
249
257
  summary: Notion API client for Ruby.
250
258
  test_files:
259
+ - spec/fixtures/notion/block_append_children.yml
260
+ - spec/fixtures/notion/block_children.yml
261
+ - spec/fixtures/notion/create_database.yml
251
262
  - spec/fixtures/notion/create_page.yml
252
263
  - spec/fixtures/notion/database.yml
253
264
  - spec/fixtures/notion/database_query.yml
254
265
  - spec/fixtures/notion/databases_list.yml
255
266
  - spec/fixtures/notion/page.yml
267
+ - spec/fixtures/notion/paginated_block_children.yml
256
268
  - spec/fixtures/notion/paginated_database_query.yml
257
269
  - spec/fixtures/notion/paginated_databases_list.yml
258
270
  - spec/fixtures/notion/paginated_users_list.yml
259
271
  - spec/fixtures/notion/update_page.yml
260
272
  - spec/fixtures/notion/users.yml
261
273
  - spec/fixtures/notion/users_list.yml
274
+ - spec/notion/api/endpoints/blocks_spec.rb
262
275
  - spec/notion/api/endpoints/databases_spec.rb
263
276
  - spec/notion/api/endpoints/pages_spec.rb
264
277
  - spec/notion/api/endpoints/users_spec.rb