notion_ruby_mapping 0.8.9 → 1.0.0
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 +4 -4
- data/.rubocop.yml +12 -1
- data/lib/notion_ruby_mapping/blocks/base.rb +33 -33
- data/lib/notion_ruby_mapping/blocks/block.rb +48 -47
- data/lib/notion_ruby_mapping/blocks/bookmark_block.rb +1 -1
- data/lib/notion_ruby_mapping/blocks/breadcrumb_block.rb +1 -1
- data/lib/notion_ruby_mapping/blocks/bulleted_list_item_block.rb +1 -1
- data/lib/notion_ruby_mapping/blocks/callout_block.rb +10 -10
- data/lib/notion_ruby_mapping/blocks/child_base_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/child_database_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/child_page_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/code_block.rb +7 -7
- data/lib/notion_ruby_mapping/blocks/column_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/column_list_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/database.rb +6 -6
- data/lib/notion_ruby_mapping/blocks/divider_block.rb +1 -1
- data/lib/notion_ruby_mapping/blocks/embed_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/equation_block.rb +5 -5
- data/lib/notion_ruby_mapping/blocks/file_base_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/file_block.rb +1 -1
- data/lib/notion_ruby_mapping/blocks/heading1_block.rb +4 -4
- data/lib/notion_ruby_mapping/blocks/heading2_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/heading3_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/image_block.rb +1 -1
- data/lib/notion_ruby_mapping/blocks/link_preview_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/link_to_page_block.rb +5 -5
- data/lib/notion_ruby_mapping/blocks/list.rb +21 -20
- data/lib/notion_ruby_mapping/blocks/numbered_list_item_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/page.rb +9 -10
- data/lib/notion_ruby_mapping/blocks/paragraph_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/pdf_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/quote_block.rb +1 -1
- data/lib/notion_ruby_mapping/blocks/synced_block.rb +5 -5
- data/lib/notion_ruby_mapping/blocks/table_block.rb +8 -8
- data/lib/notion_ruby_mapping/blocks/table_of_contents_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/table_row_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/template_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/text_sub_block_color_base_block.rb +4 -4
- data/lib/notion_ruby_mapping/blocks/to_do_block.rb +4 -4
- data/lib/notion_ruby_mapping/blocks/toggle_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/toggle_heading1_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/toggle_heading2_block.rb +2 -2
- data/lib/notion_ruby_mapping/blocks/toggle_heading3_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/url_base_block.rb +3 -3
- data/lib/notion_ruby_mapping/blocks/url_caption_base_block.rb +4 -4
- data/lib/notion_ruby_mapping/blocks/video_block.rb +2 -2
- data/lib/notion_ruby_mapping/controllers/discussion_thread.rb +1 -1
- data/lib/notion_ruby_mapping/controllers/mermaid_database.rb +34 -34
- data/lib/notion_ruby_mapping/controllers/notion_cache.rb +6 -8
- data/lib/notion_ruby_mapping/controllers/payload.rb +11 -11
- data/lib/notion_ruby_mapping/controllers/property_cache.rb +8 -7
- data/lib/notion_ruby_mapping/controllers/query.rb +10 -10
- data/lib/notion_ruby_mapping/controllers/search.rb +5 -6
- data/lib/notion_ruby_mapping/objects/comment_object.rb +2 -2
- data/lib/notion_ruby_mapping/objects/emoji_object.rb +3 -3
- data/lib/notion_ruby_mapping/objects/equation_object.rb +3 -3
- data/lib/notion_ruby_mapping/objects/file_object.rb +9 -9
- data/lib/notion_ruby_mapping/objects/mention_object.rb +43 -43
- data/lib/notion_ruby_mapping/objects/rich_text_object.rb +43 -43
- data/lib/notion_ruby_mapping/objects/text_object.rb +5 -5
- data/lib/notion_ruby_mapping/objects/user_object.rb +4 -4
- data/lib/notion_ruby_mapping/properties/button_property.rb +4 -4
- data/lib/notion_ruby_mapping/properties/checkbox_property.rb +3 -3
- data/lib/notion_ruby_mapping/properties/created_by_property.rb +3 -3
- data/lib/notion_ruby_mapping/properties/created_time_property.rb +2 -2
- data/lib/notion_ruby_mapping/properties/date_base_property.rb +14 -13
- data/lib/notion_ruby_mapping/properties/date_property.rb +17 -17
- data/lib/notion_ruby_mapping/properties/email_property.rb +3 -3
- data/lib/notion_ruby_mapping/properties/files_property.rb +16 -13
- data/lib/notion_ruby_mapping/properties/formula_property.rb +7 -7
- data/lib/notion_ruby_mapping/properties/last_edited_by_property.rb +2 -2
- data/lib/notion_ruby_mapping/properties/last_edited_time_property.rb +2 -2
- data/lib/notion_ruby_mapping/properties/multi_select_property.rb +15 -15
- data/lib/notion_ruby_mapping/properties/number_property.rb +9 -9
- data/lib/notion_ruby_mapping/properties/people_property.rb +6 -6
- data/lib/notion_ruby_mapping/properties/phone_number_property.rb +4 -4
- data/lib/notion_ruby_mapping/properties/property.rb +78 -75
- data/lib/notion_ruby_mapping/properties/relation_property.rb +18 -17
- data/lib/notion_ruby_mapping/properties/rich_text_property.rb +5 -5
- data/lib/notion_ruby_mapping/properties/rollup_property.rb +15 -15
- data/lib/notion_ruby_mapping/properties/select_property.rb +14 -14
- data/lib/notion_ruby_mapping/properties/status_property.rb +5 -5
- data/lib/notion_ruby_mapping/properties/text_property.rb +1 -1
- data/lib/notion_ruby_mapping/properties/title_property.rb +6 -6
- data/lib/notion_ruby_mapping/properties/unique_id_property.rb +3 -3
- data/lib/notion_ruby_mapping/properties/url_property.rb +3 -3
- data/lib/notion_ruby_mapping/properties/verification_property.rb +3 -3
- data/lib/notion_ruby_mapping/version.rb +1 -1
- data/notion_ruby_mapping.gemspec +1 -2
- metadata +4 -22
- data/sig/notion_ruby_mapping.rbs +0 -4
@@ -5,7 +5,7 @@ module NotionRubyMapping
|
|
5
5
|
class StatusProperty < Property
|
6
6
|
include EqualsDoesNotEqual
|
7
7
|
include IsEmptyIsNotEmpty
|
8
|
-
TYPE =
|
8
|
+
TYPE = :status
|
9
9
|
|
10
10
|
### Public announced methods
|
11
11
|
|
@@ -22,7 +22,7 @@ module NotionRubyMapping
|
|
22
22
|
# @see https://www.notion.so/hkob/StatusProperty-c8b2c83019bc42edbc1527386c7ef453#69452ceee6c9452296e96bb2a37460ee
|
23
23
|
def status_name
|
24
24
|
assert_page_property __method__
|
25
|
-
@json[
|
25
|
+
@json[:name]
|
26
26
|
end
|
27
27
|
|
28
28
|
## Page property only methods
|
@@ -32,14 +32,14 @@ module NotionRubyMapping
|
|
32
32
|
def status=(status)
|
33
33
|
assert_page_property __method__
|
34
34
|
@will_update = true
|
35
|
-
@json = {
|
35
|
+
@json = {name: status}
|
36
36
|
end
|
37
37
|
|
38
38
|
### Not public announced methods
|
39
39
|
|
40
40
|
## Common methods
|
41
41
|
|
42
|
-
# @param [String] name Property name
|
42
|
+
# @param [String, Symbol] name Property name
|
43
43
|
# @param [Boolean, Hash] json
|
44
44
|
def initialize(name, will_update: false, base_type: :page, property_id: nil, property_cache: nil, json: {})
|
45
45
|
super name, will_update: will_update, base_type: base_type, property_id: property_id,
|
@@ -52,7 +52,7 @@ module NotionRubyMapping
|
|
52
52
|
# @return [Hash]
|
53
53
|
def property_values_json
|
54
54
|
assert_page_property __method__
|
55
|
-
{@name => {
|
55
|
+
{@name => {status: @json, type: "status"}}
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -24,7 +24,7 @@ module NotionRubyMapping
|
|
24
24
|
|
25
25
|
## Common methods
|
26
26
|
|
27
|
-
# @param [String] name
|
27
|
+
# @param [String, Symbol] name
|
28
28
|
# @param [Hash, Array] json
|
29
29
|
# @param [Array<RichTextObject>] text_objects
|
30
30
|
def initialize(name, will_update: false, base_type: :page, json: nil, text_objects: nil, property_id: nil,
|
@@ -3,18 +3,18 @@
|
|
3
3
|
module NotionRubyMapping
|
4
4
|
# TitleProperty
|
5
5
|
class TitleProperty < TextProperty
|
6
|
-
TYPE =
|
6
|
+
TYPE = :title
|
7
7
|
|
8
8
|
### Not public announced methods
|
9
9
|
|
10
10
|
## Common methods
|
11
11
|
|
12
12
|
def self.rich_text_array_from_json(json)
|
13
|
-
if json[
|
13
|
+
if json[:object]&.to_sym == :list
|
14
14
|
rich_text_objects = List.new(json: json, type: :property, value: self).select { true }
|
15
|
-
RichTextArray.rich_text_array
|
15
|
+
RichTextArray.rich_text_array :title, rich_text_objects
|
16
16
|
else
|
17
|
-
RichTextArray.new
|
17
|
+
RichTextArray.new :title, json: json[:title]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -43,8 +43,8 @@ module NotionRubyMapping
|
|
43
43
|
text_json = map(&:property_values_json)
|
44
44
|
{
|
45
45
|
@name => {
|
46
|
-
|
47
|
-
|
46
|
+
type: "title",
|
47
|
+
title: text_json.empty? ? @json : text_json,
|
48
48
|
},
|
49
49
|
}
|
50
50
|
end
|
@@ -6,7 +6,7 @@ module NotionRubyMapping
|
|
6
6
|
include EqualsDoesNotEqual
|
7
7
|
include GreaterThanLessThan
|
8
8
|
include IsEmptyIsNotEmpty
|
9
|
-
TYPE =
|
9
|
+
TYPE = :unique_id
|
10
10
|
|
11
11
|
### Public announced methods
|
12
12
|
|
@@ -37,7 +37,7 @@ module NotionRubyMapping
|
|
37
37
|
# @return [NotionRubyMapping::NumberProperty]
|
38
38
|
def update_from_json(json)
|
39
39
|
@will_update = false
|
40
|
-
@json = json[
|
40
|
+
@json = json[:unique_id]
|
41
41
|
self
|
42
42
|
end
|
43
43
|
|
@@ -48,7 +48,7 @@ module NotionRubyMapping
|
|
48
48
|
# @return [Hash]
|
49
49
|
def property_values_json
|
50
50
|
assert_page_property __method__
|
51
|
-
{@name => {
|
51
|
+
{@name => {unique_id: @json, type: "unique_id"}}
|
52
52
|
end
|
53
53
|
|
54
54
|
## Database property only methods
|
@@ -7,7 +7,7 @@ module NotionRubyMapping
|
|
7
7
|
include ContainsDoesNotContain
|
8
8
|
include StartsWithEndsWith
|
9
9
|
include IsEmptyIsNotEmpty
|
10
|
-
TYPE =
|
10
|
+
TYPE = :url
|
11
11
|
|
12
12
|
### Public announced methods
|
13
13
|
|
@@ -33,7 +33,7 @@ module NotionRubyMapping
|
|
33
33
|
|
34
34
|
## Common methods
|
35
35
|
|
36
|
-
# @param [String] name Property name
|
36
|
+
# @param [String, Symbol] name Property name
|
37
37
|
def initialize(name, will_update: false, base_type: :page, json: nil, property_id: nil, property_cache: nil)
|
38
38
|
super name, will_update: will_update, base_type: base_type, property_id: property_id,
|
39
39
|
property_cache: property_cache
|
@@ -45,7 +45,7 @@ module NotionRubyMapping
|
|
45
45
|
# @return [Hash]
|
46
46
|
def property_values_json
|
47
47
|
assert_page_property __method__
|
48
|
-
{@name => {
|
48
|
+
{@name => {url: @json, type: "url"}}
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module NotionRubyMapping
|
4
4
|
# Status property
|
5
5
|
class VerificationProperty < Property
|
6
|
-
TYPE =
|
6
|
+
TYPE = :verification
|
7
7
|
|
8
8
|
### Public announced methods
|
9
9
|
|
@@ -22,7 +22,7 @@ module NotionRubyMapping
|
|
22
22
|
|
23
23
|
## Common methods
|
24
24
|
|
25
|
-
# @param [String] name Property name
|
25
|
+
# @param [String, Symbol] name Property name
|
26
26
|
# @param [Boolean, Hash] json
|
27
27
|
def initialize(name, will_update: false, base_type: :page, property_id: nil, property_cache: nil, json: {})
|
28
28
|
super name, will_update: will_update, base_type: base_type, property_id: property_id,
|
@@ -35,7 +35,7 @@ module NotionRubyMapping
|
|
35
35
|
# @return [Hash]
|
36
36
|
def property_values_json
|
37
37
|
assert_page_property __method__
|
38
|
-
{@name => {
|
38
|
+
{@name => {verification: @json, type: TYPE}}
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/notion_ruby_mapping.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "Mapping tool from Notion Database/Page/Block to Ruby Objects."
|
13
13
|
spec.homepage = "https://github.com/hkob/notion_ruby_mapping.git"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">=
|
15
|
+
spec.required_ruby_version = ">= 3.0"
|
16
16
|
|
17
17
|
# spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
|
18
18
|
|
@@ -35,7 +35,6 @@ Gem::Specification.new do |spec|
|
|
35
35
|
# spec.add_dependency "example-gem", "~> 1.0"
|
36
36
|
|
37
37
|
spec.add_dependency "faraday"
|
38
|
-
spec.add_dependency "faraday_middleware"
|
39
38
|
|
40
39
|
spec.add_development_dependency "guard"
|
41
40
|
spec.add_development_dependency "guard-rspec"
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion_ruby_mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroyuki KOBAYASHI
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: faraday
|
@@ -24,20 +23,6 @@ dependencies:
|
|
24
23
|
- - ">="
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: faraday_middleware
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
26
|
- !ruby/object:Gem::Dependency
|
42
27
|
name: guard
|
43
28
|
requirement: !ruby/object:Gem::Requirement
|
@@ -260,13 +245,11 @@ files:
|
|
260
245
|
- lib/notion_ruby_mapping/properties/verification_property.rb
|
261
246
|
- lib/notion_ruby_mapping/version.rb
|
262
247
|
- notion_ruby_mapping.gemspec
|
263
|
-
- sig/notion_ruby_mapping.rbs
|
264
248
|
- tools/an
|
265
249
|
homepage: https://github.com/hkob/notion_ruby_mapping.git
|
266
250
|
licenses:
|
267
251
|
- MIT
|
268
252
|
metadata: {}
|
269
|
-
post_install_message:
|
270
253
|
rdoc_options: []
|
271
254
|
require_paths:
|
272
255
|
- lib
|
@@ -274,15 +257,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
274
257
|
requirements:
|
275
258
|
- - ">="
|
276
259
|
- !ruby/object:Gem::Version
|
277
|
-
version:
|
260
|
+
version: '3.0'
|
278
261
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
279
262
|
requirements:
|
280
263
|
- - ">="
|
281
264
|
- !ruby/object:Gem::Version
|
282
265
|
version: '0'
|
283
266
|
requirements: []
|
284
|
-
rubygems_version: 3.
|
285
|
-
signing_key:
|
267
|
+
rubygems_version: 3.6.9
|
286
268
|
specification_version: 4
|
287
269
|
summary: Notion Ruby mapping tool
|
288
270
|
test_files: []
|
data/sig/notion_ruby_mapping.rbs
DELETED