notion_orbit 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -3
- data/README.md +15 -0
- data/lib/notion_orbit/interactions/note.rb +1 -1
- data/lib/notion_orbit/notion.rb +1 -1
- data/lib/notion_orbit/notion_objects/block.rb +6 -5
- data/lib/notion_orbit/notion_objects/blocks.rb +3 -2
- data/lib/notion_orbit/services/notion.rb +3 -3
- data/lib/notion_orbit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9212765f3f8c539ed6689c691c7b3dbbe153b6e87dfa46aa18015f73f604e307
|
4
|
+
data.tar.gz: a66c78859bd2baf48e24c4ee0bf531a02e323d7cd79513ee4ab0bb9ac86c6634
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f314324f7ac9a3236b2761f474fbe7f3d8d76c62ecee85e0498ed175bcbe2d89031b7c5452bd7c1362b07f7d73cceff4a1e240b4a77f1f00cd57ae03cf1d29e
|
7
|
+
data.tar.gz: 202ff8d7842fd40d2978661d6de8548fe48978debb3f002d25cdf01922d5c00e3f075f1216b93db79edf22baa442d7823d5fd04c6194cb65813c65b7a620c6e0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
notion_orbit (0.0.
|
4
|
+
notion_orbit (0.0.2)
|
5
5
|
dotenv
|
6
6
|
http (~> 4.4)
|
7
7
|
json (~> 2.5)
|
@@ -22,18 +22,22 @@ GEM
|
|
22
22
|
domain_name (0.5.20190701)
|
23
23
|
unf (>= 0.0.5, < 1.0.0)
|
24
24
|
dotenv (2.7.6)
|
25
|
-
faraday (1.4.
|
25
|
+
faraday (1.4.2)
|
26
|
+
faraday-em_http (~> 1.0)
|
27
|
+
faraday-em_synchrony (~> 1.0)
|
26
28
|
faraday-excon (~> 1.1)
|
27
29
|
faraday-net_http (~> 1.0)
|
28
30
|
faraday-net_http_persistent (~> 1.1)
|
29
31
|
multipart-post (>= 1.2, < 3)
|
30
32
|
ruby2_keywords (>= 0.0.4)
|
33
|
+
faraday-em_http (1.0.0)
|
34
|
+
faraday-em_synchrony (1.0.0)
|
31
35
|
faraday-excon (1.1.0)
|
32
36
|
faraday-net_http (1.0.1)
|
33
37
|
faraday-net_http_persistent (1.1.0)
|
34
38
|
faraday_middleware (1.0.0)
|
35
39
|
faraday (~> 1.0)
|
36
|
-
ffi (1.15.
|
40
|
+
ffi (1.15.1)
|
37
41
|
ffi-compiler (1.0.1)
|
38
42
|
ffi (>= 1.0.0)
|
39
43
|
rake
|
data/README.md
CHANGED
@@ -79,6 +79,21 @@ Then, once those fields are set up, the method can be called as follows:
|
|
79
79
|
client.notes
|
80
80
|
```
|
81
81
|
|
82
|
+
#### Supported Notion Content Blocks and Types
|
83
|
+
|
84
|
+
This integration has built-in support to convert the following Notion content block and types into markdown and rendered in Orbit:
|
85
|
+
|
86
|
+
* Heading Level 1
|
87
|
+
* Heading Level 2
|
88
|
+
* Heading Level 3
|
89
|
+
* Numbered List
|
90
|
+
* Bulleted List
|
91
|
+
* Paragraph Block
|
92
|
+
* To-Do List
|
93
|
+
* Bold Font
|
94
|
+
* Italic Font
|
95
|
+
* Code Blocks
|
96
|
+
|
82
97
|
## CLI Usage
|
83
98
|
|
84
99
|
You can also use this package with the included CLI. To use the CLI pass in the required environment variables on the command line before invoking the CLI.
|
@@ -16,7 +16,7 @@ module NotionOrbit
|
|
16
16
|
|
17
17
|
def after_initialize!
|
18
18
|
orbit_service = NotionOrbit::Services::Orbit.new(orbit_workspace: @orbit_workspace, orbit_api_key: @orbit_api_key)
|
19
|
-
notion_service = NotionOrbit::Services::Notion.new(
|
19
|
+
notion_service = NotionOrbit::Services::Notion.new(notion_api_key: @notion_api_key)
|
20
20
|
|
21
21
|
orbit_service.send_note(
|
22
22
|
member_slug: @note[:member_slug],
|
data/lib/notion_orbit/notion.rb
CHANGED
@@ -11,7 +11,7 @@ module NotionOrbit
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def process_notes
|
14
|
-
notion_service = NotionOrbit::Services::Notion.new(
|
14
|
+
notion_service = NotionOrbit::Services::Notion.new(notion_api_key: @notion_api_key)
|
15
15
|
orbit_service = NotionOrbit::Services::Orbit.new(orbit_workspace: @orbit_workspace, orbit_api_key: @orbit_api_key)
|
16
16
|
|
17
17
|
notes = notion_service.notes(database_id: @notion_database_id)
|
@@ -2,7 +2,7 @@ module NotionOrbit
|
|
2
2
|
module NotionObjects
|
3
3
|
class Block
|
4
4
|
class << self
|
5
|
-
def new_from_raw_block(raw_block, indentation: 0)
|
5
|
+
def new_from_raw_block(raw_block, notion_api_key, indentation: 0)
|
6
6
|
klass = case raw_block.type
|
7
7
|
when 'bulleted_list_item'
|
8
8
|
NotionOrbit::NotionObjects::BlockTypes::BulletedListItem
|
@@ -21,16 +21,17 @@ module NotionOrbit
|
|
21
21
|
else
|
22
22
|
NotionOrbit::NotionObjects::BlockTypes::Unsupported
|
23
23
|
end
|
24
|
-
klass.new(raw_block, indentation)
|
24
|
+
klass.new(raw_block, notion_api_key, indentation)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
def initialize(raw_block, indentation)
|
28
|
+
def initialize(raw_block, notion_api_key, indentation)
|
29
29
|
@raw_block = raw_block
|
30
30
|
@id = raw_block.id
|
31
31
|
@type = raw_block.type
|
32
32
|
@has_children = raw_block.has_children
|
33
33
|
@indentation = indentation
|
34
|
+
@notion_api_key = notion_api_key
|
34
35
|
end
|
35
36
|
|
36
37
|
def to_markdown
|
@@ -41,7 +42,7 @@ module NotionOrbit
|
|
41
42
|
if @has_children
|
42
43
|
raw_children = notion_service.client.block_children(id: @id).results
|
43
44
|
children_indentation = indent_children? ? @indentation + 2 : @indentation
|
44
|
-
children_blocks = Blocks.new(raw_children, indentation: children_indentation)
|
45
|
+
children_blocks = Blocks.new(raw_children, @notion_api_key, indentation: children_indentation)
|
45
46
|
markdown += "\n\n" + children_blocks.to_markdown
|
46
47
|
end
|
47
48
|
|
@@ -53,7 +54,7 @@ module NotionOrbit
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def notion_service
|
56
|
-
@notion_service ||= NotionOrbit::Services::Notion.new
|
57
|
+
@notion_service ||= NotionOrbit::Services::Notion.new(notion_api_key: @notion_api_key)
|
57
58
|
end
|
58
59
|
end
|
59
60
|
end
|
@@ -5,8 +5,9 @@ module NotionOrbit
|
|
5
5
|
|
6
6
|
attr_accessor :blocks
|
7
7
|
|
8
|
-
def initialize(raw_blocks, indentation: 0)
|
9
|
-
@blocks = raw_blocks.map{ |raw_block| Block.new_from_raw_block(raw_block, indentation: indentation) }
|
8
|
+
def initialize(raw_blocks, notion_api_key, indentation: 0)
|
9
|
+
@blocks = raw_blocks.map{ |raw_block| Block.new_from_raw_block(raw_block, notion_api_key, indentation: indentation) }
|
10
|
+
@notion_api_key = notion_api_key
|
10
11
|
@indentation = indentation
|
11
12
|
end
|
12
13
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module NotionOrbit
|
2
2
|
module Services
|
3
3
|
class Notion
|
4
|
-
attr_reader :client, :
|
4
|
+
attr_reader :client, :notion_api_key
|
5
5
|
|
6
6
|
def initialize(params = {})
|
7
|
-
@client = ::Notion::Client.new(token: params
|
7
|
+
@client = ::Notion::Client.new(token: params[:notion_api_key])
|
8
8
|
end
|
9
9
|
|
10
10
|
def notes(database_id:)
|
@@ -43,7 +43,7 @@ module NotionOrbit
|
|
43
43
|
|
44
44
|
def page_content(page)
|
45
45
|
raw_blocks = @client.block_children(id: page.id).results
|
46
|
-
blocks = NotionOrbit::NotionObjects::Blocks.new(raw_blocks)
|
46
|
+
blocks = NotionOrbit::NotionObjects::Blocks.new(raw_blocks, @client.token)
|
47
47
|
content = blocks.to_markdown
|
48
48
|
content += "\\n\\n"
|
49
49
|
content += "[Open in Notion](#{page_url(page[:id])})"
|
data/lib/notion_orbit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion_orbit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Orbit DevRel
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2021-
|
13
|
+
date: 2021-06-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: http
|