notion-sdk-ruby 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +43 -34
- data/.gitignore +13 -13
- data/.rspec +3 -3
- data/.travis.yml +6 -6
- data/.vscode/settings.json +3 -3
- data/Gemfile +4 -4
- data/Gemfile.lock +15 -7
- data/LICENSE.txt +21 -21
- data/README.md +55 -339
- data/Rakefile +12 -7
- data/bin/console +11 -11
- data/bin/setup +8 -8
- data/lib/notion-sdk-ruby/api/blocks.rb +56 -0
- data/lib/notion-sdk-ruby/api/databases.rb +47 -0
- data/lib/notion-sdk-ruby/api/pages.rb +36 -0
- data/lib/notion-sdk-ruby/api/search.rb +17 -0
- data/lib/notion-sdk-ruby/api/users.rb +24 -0
- data/lib/notion-sdk-ruby/client.rb +30 -27
- data/lib/notion-sdk-ruby/config.rb +5 -5
- data/lib/notion-sdk-ruby/error.rb +52 -52
- data/lib/notion-sdk-ruby/models/block.rb +7 -4
- data/lib/notion-sdk-ruby/models/database.rb +7 -4
- data/lib/notion-sdk-ruby/models/list.rb +49 -27
- data/lib/notion-sdk-ruby/models/page.rb +7 -4
- data/lib/notion-sdk-ruby/models/user.rb +7 -4
- data/lib/notion-sdk-ruby/request_client.rb +45 -45
- data/lib/notion-sdk-ruby/version.rb +3 -3
- data/lib/notion-sdk-ruby.rb +36 -33
- data/notion-sdk-ruby.gemspec +41 -39
- data/todos.md +11 -0
- metadata +41 -12
- data/lib/notion-sdk-ruby/operations/search.rb +0 -12
- data/lib/notion-sdk-ruby/resources/blocks.rb +0 -33
- data/lib/notion-sdk-ruby/resources/databases.rb +0 -32
- data/lib/notion-sdk-ruby/resources/pages.rb +0 -20
- data/lib/notion-sdk-ruby/resources/users.rb +0 -15
data/lib/notion-sdk-ruby.rb
CHANGED
@@ -1,33 +1,36 @@
|
|
1
|
-
require "faraday"
|
2
|
-
require "faraday_middleware"
|
3
|
-
require "forwardable"
|
4
|
-
require "ostruct"
|
5
|
-
|
6
|
-
require "notion-sdk-ruby/version"
|
7
|
-
require "notion-sdk-ruby/config"
|
8
|
-
require "notion-sdk-ruby/request_client"
|
9
|
-
require "notion-sdk-ruby/
|
10
|
-
|
11
|
-
require "notion-sdk-ruby/
|
12
|
-
require "notion-sdk-ruby/
|
13
|
-
require "notion-sdk-ruby/
|
14
|
-
require "notion-sdk-ruby/
|
15
|
-
require "notion-sdk-ruby/
|
16
|
-
|
17
|
-
require "notion-sdk-ruby/
|
18
|
-
require "notion-sdk-ruby/
|
19
|
-
require "notion-sdk-ruby/
|
20
|
-
require "notion-sdk-ruby/
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
1
|
+
require "faraday"
|
2
|
+
require "faraday_middleware"
|
3
|
+
require "forwardable"
|
4
|
+
require "ostruct"
|
5
|
+
|
6
|
+
require "notion-sdk-ruby/version"
|
7
|
+
require "notion-sdk-ruby/config"
|
8
|
+
require "notion-sdk-ruby/request_client"
|
9
|
+
require "notion-sdk-ruby/error"
|
10
|
+
|
11
|
+
require "notion-sdk-ruby/models/user"
|
12
|
+
require "notion-sdk-ruby/models/list"
|
13
|
+
require "notion-sdk-ruby/models/block"
|
14
|
+
require "notion-sdk-ruby/models/database"
|
15
|
+
require "notion-sdk-ruby/models/page"
|
16
|
+
|
17
|
+
require "notion-sdk-ruby/api/blocks"
|
18
|
+
require "notion-sdk-ruby/api/databases"
|
19
|
+
require "notion-sdk-ruby/api/pages"
|
20
|
+
require "notion-sdk-ruby/api/users"
|
21
|
+
require "notion-sdk-ruby/api/search"
|
22
|
+
|
23
|
+
require "notion-sdk-ruby/client"
|
24
|
+
|
25
|
+
module Notion
|
26
|
+
@config = Config.new
|
27
|
+
|
28
|
+
class << self
|
29
|
+
extend Forwardable
|
30
|
+
|
31
|
+
attr_reader :config
|
32
|
+
|
33
|
+
def_delegators :@config, :api_token, :api_token=
|
34
|
+
def_delegators :@config, :notion_version, :notion_version=
|
35
|
+
end
|
36
|
+
end
|
data/notion-sdk-ruby.gemspec
CHANGED
@@ -1,39 +1,41 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require_relative "lib/notion-sdk-ruby/version"
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = "notion-sdk-ruby"
|
7
|
-
spec.version = Notion::VERSION
|
8
|
-
spec.authors = ["Graham Marlow"]
|
9
|
-
spec.email = ["mgmarlow@hey.com"]
|
10
|
-
|
11
|
-
spec.summary = "Notion SDK"
|
12
|
-
spec.homepage = "https://github.com/mgmarlow/notion-sdk-ruby"
|
13
|
-
spec.license = "MIT"
|
14
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
15
|
-
|
16
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
-
spec.metadata["source_code_uri"] = "https://github.com/mgmarlow/notion-sdk-ruby"
|
18
|
-
spec.metadata["changelog_uri"] = "https://github.com/mgmarlow/notion-sdk-ruby/blob/master/CHANGELOG.md"
|
19
|
-
|
20
|
-
# Specify which files should be added to the gem when it is released.
|
21
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
-
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
23
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
-
end
|
25
|
-
spec.bindir = "exe"
|
26
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
-
spec.require_paths = ["lib"]
|
28
|
-
|
29
|
-
spec.add_dependency "faraday", "~> 1.8"
|
30
|
-
spec.add_dependency "faraday_middleware", "~> 1.1"
|
31
|
-
|
32
|
-
spec.add_development_dependency "rake", "~> 12.0"
|
33
|
-
spec.add_development_dependency "rspec", "~> 3.0"
|
34
|
-
spec.add_development_dependency "standardrb", "~> 1.0"
|
35
|
-
spec.add_development_dependency "webmock", "~> 3.12"
|
36
|
-
spec.add_development_dependency "pry", "~> 0.14.1"
|
37
|
-
spec.add_development_dependency "dotenv", "~> 2.7"
|
38
|
-
spec.add_development_dependency "activesupport", "~> 6.1"
|
39
|
-
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require_relative "lib/notion-sdk-ruby/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "notion-sdk-ruby"
|
7
|
+
spec.version = Notion::VERSION
|
8
|
+
spec.authors = ["Graham Marlow"]
|
9
|
+
spec.email = ["mgmarlow@hey.com"]
|
10
|
+
|
11
|
+
spec.summary = "Notion SDK"
|
12
|
+
spec.homepage = "https://github.com/mgmarlow/notion-sdk-ruby"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/mgmarlow/notion-sdk-ruby"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/mgmarlow/notion-sdk-ruby/blob/master/CHANGELOG.md"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency "faraday", "~> 1.8"
|
30
|
+
spec.add_dependency "faraday_middleware", "~> 1.1"
|
31
|
+
|
32
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
33
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
34
|
+
spec.add_development_dependency "standardrb", "~> 1.0"
|
35
|
+
spec.add_development_dependency "webmock", "~> 3.12"
|
36
|
+
spec.add_development_dependency "pry", "~> 0.14.1"
|
37
|
+
spec.add_development_dependency "dotenv", "~> 2.7"
|
38
|
+
spec.add_development_dependency "activesupport", "~> 6.1"
|
39
|
+
spec.add_development_dependency "yard", "~> 0.9.26"
|
40
|
+
spec.add_development_dependency "vcr", "~> 6.0"
|
41
|
+
end
|
data/todos.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# todos
|
2
|
+
|
3
|
+
- [x] Add VCR
|
4
|
+
- [x] Swap over specs to use VCR
|
5
|
+
- [x] Update to latest notion SDK version
|
6
|
+
- [x] Improve generated docs by removing extra module namespaces
|
7
|
+
- [x] Remove manual docs from readme, move to auto-generated docs
|
8
|
+
- [ ] New endpoint: Delete block
|
9
|
+
- [ ] New endpoint: Retrieve a page property item
|
10
|
+
- [ ] Pagination APIs
|
11
|
+
- [ ] Examples
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion-sdk-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Graham Marlow
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -136,7 +136,35 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '6.1'
|
139
|
-
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.9.26
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.9.26
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: vcr
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '6.0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '6.0'
|
167
|
+
description:
|
140
168
|
email:
|
141
169
|
- mgmarlow@hey.com
|
142
170
|
executables: []
|
@@ -156,6 +184,11 @@ files:
|
|
156
184
|
- bin/console
|
157
185
|
- bin/setup
|
158
186
|
- lib/notion-sdk-ruby.rb
|
187
|
+
- lib/notion-sdk-ruby/api/blocks.rb
|
188
|
+
- lib/notion-sdk-ruby/api/databases.rb
|
189
|
+
- lib/notion-sdk-ruby/api/pages.rb
|
190
|
+
- lib/notion-sdk-ruby/api/search.rb
|
191
|
+
- lib/notion-sdk-ruby/api/users.rb
|
159
192
|
- lib/notion-sdk-ruby/client.rb
|
160
193
|
- lib/notion-sdk-ruby/config.rb
|
161
194
|
- lib/notion-sdk-ruby/error.rb
|
@@ -164,14 +197,10 @@ files:
|
|
164
197
|
- lib/notion-sdk-ruby/models/list.rb
|
165
198
|
- lib/notion-sdk-ruby/models/page.rb
|
166
199
|
- lib/notion-sdk-ruby/models/user.rb
|
167
|
-
- lib/notion-sdk-ruby/operations/search.rb
|
168
200
|
- lib/notion-sdk-ruby/request_client.rb
|
169
|
-
- lib/notion-sdk-ruby/resources/blocks.rb
|
170
|
-
- lib/notion-sdk-ruby/resources/databases.rb
|
171
|
-
- lib/notion-sdk-ruby/resources/pages.rb
|
172
|
-
- lib/notion-sdk-ruby/resources/users.rb
|
173
201
|
- lib/notion-sdk-ruby/version.rb
|
174
202
|
- notion-sdk-ruby.gemspec
|
203
|
+
- todos.md
|
175
204
|
homepage: https://github.com/mgmarlow/notion-sdk-ruby
|
176
205
|
licenses:
|
177
206
|
- MIT
|
@@ -179,7 +208,7 @@ metadata:
|
|
179
208
|
homepage_uri: https://github.com/mgmarlow/notion-sdk-ruby
|
180
209
|
source_code_uri: https://github.com/mgmarlow/notion-sdk-ruby
|
181
210
|
changelog_uri: https://github.com/mgmarlow/notion-sdk-ruby/blob/master/CHANGELOG.md
|
182
|
-
post_install_message:
|
211
|
+
post_install_message:
|
183
212
|
rdoc_options: []
|
184
213
|
require_paths:
|
185
214
|
- lib
|
@@ -194,8 +223,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
223
|
- !ruby/object:Gem::Version
|
195
224
|
version: '0'
|
196
225
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
198
|
-
signing_key:
|
226
|
+
rubygems_version: 3.3.7
|
227
|
+
signing_key:
|
199
228
|
specification_version: 4
|
200
229
|
summary: Notion SDK
|
201
230
|
test_files: []
|
@@ -1,33 +0,0 @@
|
|
1
|
-
module Notion
|
2
|
-
class Blocks
|
3
|
-
include RequestClient
|
4
|
-
|
5
|
-
def children
|
6
|
-
Children.new
|
7
|
-
end
|
8
|
-
|
9
|
-
def retrieve(block_id)
|
10
|
-
response = get("/v1/blocks/#{block_id}")
|
11
|
-
Block.new(response.body)
|
12
|
-
end
|
13
|
-
|
14
|
-
def update(block_id, body)
|
15
|
-
response = patch("/v1/blocks/#{block_id}", body.to_json)
|
16
|
-
Block.new(response.body)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
class Children
|
21
|
-
include RequestClient
|
22
|
-
|
23
|
-
def list(block_id, query: {})
|
24
|
-
response = get("/v1/blocks/#{block_id}/children", query: query)
|
25
|
-
List.new(response.body)
|
26
|
-
end
|
27
|
-
|
28
|
-
def append(block_id, body)
|
29
|
-
response = patch("/v1/blocks/#{block_id}/children", body.to_json)
|
30
|
-
Block.new(response.body)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module Notion
|
2
|
-
class Databases
|
3
|
-
include RequestClient
|
4
|
-
|
5
|
-
def retrieve(id)
|
6
|
-
response = get("/v1/databases/#{id}")
|
7
|
-
Database.new(response.body)
|
8
|
-
end
|
9
|
-
|
10
|
-
# DEPRECATED
|
11
|
-
def list
|
12
|
-
warn "DEPRECATED: client.databases.list is deprecated."
|
13
|
-
response = get("/v1/databases")
|
14
|
-
List.new(response.body)
|
15
|
-
end
|
16
|
-
|
17
|
-
def query(id, body)
|
18
|
-
response = post("/v1/databases/#{id}/query", body.to_json)
|
19
|
-
List.new(response.body)
|
20
|
-
end
|
21
|
-
|
22
|
-
def create(body)
|
23
|
-
response = post("/v1/databases", body.to_json)
|
24
|
-
Database.new(response.body)
|
25
|
-
end
|
26
|
-
|
27
|
-
def update(id, body)
|
28
|
-
response = patch("/v1/databases/#{id}", body.to_json)
|
29
|
-
Database.new(response.body)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Notion
|
2
|
-
class Pages
|
3
|
-
include RequestClient
|
4
|
-
|
5
|
-
def retrieve(id)
|
6
|
-
response = get("/v1/pages/#{id}")
|
7
|
-
Page.new(response.body)
|
8
|
-
end
|
9
|
-
|
10
|
-
def create(body)
|
11
|
-
response = post("/v1/pages", body.to_json)
|
12
|
-
Page.new(response.body)
|
13
|
-
end
|
14
|
-
|
15
|
-
def update(id, body)
|
16
|
-
response = patch("/v1/pages/#{id}", body.to_json)
|
17
|
-
Page.new(response.body)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|