notion_orbit 0.0.3 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9212765f3f8c539ed6689c691c7b3dbbe153b6e87dfa46aa18015f73f604e307
4
- data.tar.gz: a66c78859bd2baf48e24c4ee0bf531a02e323d7cd79513ee4ab0bb9ac86c6634
3
+ metadata.gz: 116a98dffbf099846be57d49f61a5f2fa6c1727ad2f8e98bb988f91bc1f15825
4
+ data.tar.gz: 188ebd7486042a2c9446062cb421c6f774e828960cbd4ddac715116296310347
5
5
  SHA512:
6
- metadata.gz: 9f314324f7ac9a3236b2761f474fbe7f3d8d76c62ecee85e0498ed175bcbe2d89031b7c5452bd7c1362b07f7d73cceff4a1e240b4a77f1f00cd57ae03cf1d29e
7
- data.tar.gz: 202ff8d7842fd40d2978661d6de8548fe48978debb3f002d25cdf01922d5c00e3f075f1216b93db79edf22baa442d7823d5fd04c6194cb65813c65b7a620c6e0
6
+ metadata.gz: 329efa41e0800cca22f4cf16519de5fc0c20d3cfc9052fc803095d690954edeba4598bb8fee1866d124607bd73e1f1872c436d5d07826398af56974a85c62e38
7
+ data.tar.gz: 303344d6953d77ce3f2bdac4371fb1e56192241c435f17bc8893777824cc2d5669d344d02f3cf4a81527ce46dd5c3dca9c2b4fa078ae54f65cd92df37bb2654d
data/Gemfile.lock CHANGED
@@ -1,18 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notion_orbit (0.0.2)
4
+ notion_orbit (0.0.5)
5
5
  dotenv
6
6
  http (~> 4.4)
7
7
  json (~> 2.5)
8
- notion-ruby-client
8
+ notion-ruby-client (~> 0.0.8)
9
9
  thor (~> 1.1)
10
10
  zeitwerk (~> 2.4)
11
11
 
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- addressable (2.7.0)
15
+ addressable (2.8.0)
16
16
  public_suffix (>= 2.0.2, < 5.0)
17
17
  ast (2.4.2)
18
18
  byebug (11.1.3)
@@ -22,22 +22,28 @@ 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.2)
25
+ faraday (1.7.0)
26
26
  faraday-em_http (~> 1.0)
27
27
  faraday-em_synchrony (~> 1.0)
28
28
  faraday-excon (~> 1.1)
29
+ faraday-httpclient (~> 1.0.1)
29
30
  faraday-net_http (~> 1.0)
30
31
  faraday-net_http_persistent (~> 1.1)
32
+ faraday-patron (~> 1.0)
33
+ faraday-rack (~> 1.0)
31
34
  multipart-post (>= 1.2, < 3)
32
35
  ruby2_keywords (>= 0.0.4)
33
36
  faraday-em_http (1.0.0)
34
37
  faraday-em_synchrony (1.0.0)
35
38
  faraday-excon (1.1.0)
39
+ faraday-httpclient (1.0.1)
36
40
  faraday-net_http (1.0.1)
37
- faraday-net_http_persistent (1.1.0)
38
- faraday_middleware (1.0.0)
41
+ faraday-net_http_persistent (1.2.0)
42
+ faraday-patron (1.0.0)
43
+ faraday-rack (1.0.0)
44
+ faraday_middleware (1.1.0)
39
45
  faraday (~> 1.0)
40
- ffi (1.15.1)
46
+ ffi (1.15.3)
41
47
  ffi-compiler (1.0.1)
42
48
  ffi (>= 1.0.0)
43
49
  rake
@@ -48,23 +54,23 @@ GEM
48
54
  http-cookie (~> 1.0)
49
55
  http-form_data (~> 2.2)
50
56
  http-parser (~> 1.2.0)
51
- http-cookie (1.0.3)
57
+ http-cookie (1.0.4)
52
58
  domain_name (~> 0.5)
53
59
  http-form_data (2.3.0)
54
60
  http-parser (1.2.3)
55
61
  ffi-compiler (>= 1.0, < 2.0)
56
62
  json (2.5.1)
57
63
  multipart-post (2.1.1)
58
- notion-ruby-client (0.0.5)
64
+ notion-ruby-client (0.0.8)
59
65
  faraday (>= 1.0)
60
66
  faraday_middleware
61
67
  hashie
62
68
  parallel (1.20.1)
63
- parser (3.0.1.1)
69
+ parser (3.0.2.0)
64
70
  ast (~> 2.4.1)
65
71
  public_suffix (4.0.6)
66
72
  rainbow (3.0.0)
67
- rake (13.0.3)
73
+ rake (13.0.6)
68
74
  regexp_parser (2.1.1)
69
75
  rexml (3.2.5)
70
76
  rspec (3.10.0)
@@ -80,26 +86,26 @@ GEM
80
86
  diff-lcs (>= 1.2.0, < 2.0)
81
87
  rspec-support (~> 3.10.0)
82
88
  rspec-support (3.10.2)
83
- rubocop (1.15.0)
89
+ rubocop (1.19.0)
84
90
  parallel (~> 1.10)
85
91
  parser (>= 3.0.0.0)
86
92
  rainbow (>= 2.2.2, < 4.0)
87
93
  regexp_parser (>= 1.8, < 3.0)
88
94
  rexml
89
- rubocop-ast (>= 1.5.0, < 2.0)
95
+ rubocop-ast (>= 1.9.1, < 2.0)
90
96
  ruby-progressbar (~> 1.7)
91
97
  unicode-display_width (>= 1.4.0, < 3.0)
92
- rubocop-ast (1.6.0)
98
+ rubocop-ast (1.10.0)
93
99
  parser (>= 3.0.1.1)
94
100
  ruby-progressbar (1.11.0)
95
- ruby2_keywords (0.0.4)
101
+ ruby2_keywords (0.0.5)
96
102
  thor (1.1.0)
97
103
  unf (0.1.4)
98
104
  unf_ext
99
105
  unf_ext (0.0.7.7)
100
106
  unicode-display_width (2.0.0)
101
- webmock (3.13.0)
102
- addressable (>= 2.3.6)
107
+ webmock (3.14.0)
108
+ addressable (>= 2.8.0)
103
109
  crack (>= 0.3.2)
104
110
  hashdiff (>= 0.4.0, < 2.0.0)
105
111
  zeitwerk (2.4.2)
@@ -10,7 +10,7 @@ module NotionOrbit
10
10
  @notion_workspace_slug = params.fetch(:notion_workspace_slug)
11
11
  end
12
12
 
13
- def process_notes
13
+ def process_notes
14
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
 
@@ -9,9 +9,11 @@ module NotionOrbit
9
9
 
10
10
  def notes(database_id:)
11
11
  pages = @client.database_query(id: database_id).results
12
-
12
+
13
13
  # only process pages that opt-in to sending the note to Orbit
14
- pages = pages.filter { |page| page.properties['Send to Orbit'].checkbox }
14
+ pages = pages.filter { |page| page.properties['Send to Orbit'].checkbox && page[:properties]['Member Email'].email }
15
+
16
+ pages = pages.filter { |page| page.properties['Orbit Status'].rich_text[0] == nil }
15
17
  puts pages
16
18
 
17
19
  notes = []
@@ -21,6 +23,7 @@ module NotionOrbit
21
23
  content: page_content(page)
22
24
  }
23
25
  end
26
+
24
27
  notes
25
28
  end
26
29
 
@@ -37,7 +40,7 @@ module NotionOrbit
37
40
  def page_properties(page)
38
41
  {
39
42
  email: page[:properties]['Member Email'].email,
40
- page_id: page[:id]
43
+ page_id: "#{page[:id]}"
41
44
  }
42
45
  end
43
46
 
@@ -45,12 +48,16 @@ module NotionOrbit
45
48
  raw_blocks = @client.block_children(id: page.id).results
46
49
  blocks = NotionOrbit::NotionObjects::Blocks.new(raw_blocks, @client.token)
47
50
  content = blocks.to_markdown
51
+ note_title = page[:properties]["Name"]["title"][0]["text"]["content"] || "Untitled Note"
48
52
  content += "\\n\\n"
49
- content += "[Open in Notion](#{page_url(page[:id])})"
53
+ content += "[Open in Notion](#{page_url(page[:id], note_title)})"
50
54
  end
51
55
 
52
- def page_url(page_id)
53
- "https://notion.so/#{ENV['NOTION_WORKSPACE_SLUG']}/#{page_id}}"
56
+ def page_url(page_id, page_title)
57
+ page_title&.strip.gsub!(" ", "-")
58
+ page_id&.gsub!("-", "")
59
+
60
+ "https://notion.so/#{ENV['NOTION_WORKSPACE_SLUG']}/#{page_title}-#{page_id}"
54
61
  end
55
62
  end
56
63
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NotionOrbit
4
- VERSION = "0.0.3"
4
+ VERSION = "0.0.7"
5
5
  end
data/notion_orbit.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "http", "~> 4.4"
33
33
  spec.add_dependency "json", "~> 2.5"
34
34
  spec.add_dependency "zeitwerk", "~> 2.4"
35
- spec.add_dependency "notion-ruby-client"
35
+ spec.add_dependency "notion-ruby-client", "~> 0.0.8"
36
36
  spec.add_dependency "thor", "~> 1.1"
37
37
  spec.add_dependency "dotenv"
38
38
  spec.add_development_dependency "rspec", "~> 3.4"
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.3
4
+ version: 0.0.7
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-06-08 00:00:00.000000000 Z
13
+ date: 2021-08-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: http
@@ -58,16 +58,16 @@ dependencies:
58
58
  name: notion-ruby-client
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - ">="
61
+ - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '0'
63
+ version: 0.0.8
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ">="
68
+ - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '0'
70
+ version: 0.0.8
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: thor
73
73
  requirement: !ruby/object:Gem::Requirement