notion_ruby_mapping 0.6.6 → 0.6.8
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/README.md +2 -0
- data/lib/notion_ruby_mapping/blocks/base.rb +8 -6
- data/lib/notion_ruby_mapping/blocks/block.rb +3 -1
- data/lib/notion_ruby_mapping/blocks/database.rb +6 -1
- data/lib/notion_ruby_mapping/blocks/heading1_block.rb +8 -0
- data/lib/notion_ruby_mapping/blocks/heading2_block.rb +8 -0
- data/lib/notion_ruby_mapping/blocks/heading3_block.rb +8 -0
- data/lib/notion_ruby_mapping/blocks/list.rb +19 -5
- data/lib/notion_ruby_mapping/blocks/page.rb +7 -2
- data/lib/notion_ruby_mapping/blocks/toggle_heading1_block.rb +8 -0
- data/lib/notion_ruby_mapping/blocks/toggle_heading2_block.rb +8 -0
- data/lib/notion_ruby_mapping/blocks/toggle_heading3_block.rb +8 -0
- data/lib/notion_ruby_mapping/controllers/discussion_thread.rb +1 -1
- data/lib/notion_ruby_mapping/controllers/notion_cache.rb +35 -0
- data/lib/notion_ruby_mapping/controllers/property_cache.rb +4 -0
- data/lib/notion_ruby_mapping/objects/comment_object.rb +1 -1
- data/lib/notion_ruby_mapping/objects/user_object.rb +35 -3
- data/lib/notion_ruby_mapping/properties/checkbox_property.rb +4 -3
- data/lib/notion_ruby_mapping/properties/created_by_property.rb +4 -2
- data/lib/notion_ruby_mapping/properties/created_time_property.rb +3 -2
- data/lib/notion_ruby_mapping/properties/date_base_property.rb +59 -57
- data/lib/notion_ruby_mapping/properties/date_property.rb +8 -6
- data/lib/notion_ruby_mapping/properties/email_property.rb +3 -2
- data/lib/notion_ruby_mapping/properties/files_property.rb +4 -2
- data/lib/notion_ruby_mapping/properties/formula_property.rb +4 -2
- data/lib/notion_ruby_mapping/properties/last_edited_by_property.rb +4 -2
- data/lib/notion_ruby_mapping/properties/last_edited_time_property.rb +3 -2
- data/lib/notion_ruby_mapping/properties/multi_select_property.rb +4 -2
- data/lib/notion_ruby_mapping/properties/number_property.rb +5 -3
- data/lib/notion_ruby_mapping/properties/people_property.rb +11 -3
- data/lib/notion_ruby_mapping/properties/phone_number_property.rb +3 -2
- data/lib/notion_ruby_mapping/properties/property.rb +44 -36
- data/lib/notion_ruby_mapping/properties/relation_property.rb +6 -6
- data/lib/notion_ruby_mapping/properties/rollup_property.rb +4 -2
- data/lib/notion_ruby_mapping/properties/select_property.rb +4 -2
- data/lib/notion_ruby_mapping/properties/status_property.rb +26 -4
- data/lib/notion_ruby_mapping/properties/text_property.rb +4 -2
- data/lib/notion_ruby_mapping/properties/title_property.rb +6 -2
- data/lib/notion_ruby_mapping/properties/url_property.rb +3 -2
- data/lib/notion_ruby_mapping/version.rb +1 -1
- metadata +2 -2
@@ -3,24 +3,47 @@
|
|
3
3
|
module NotionRubyMapping
|
4
4
|
# Status property
|
5
5
|
class StatusProperty < Property
|
6
|
+
include EqualsDoesNotEqual
|
7
|
+
include IsEmptyIsNotEmpty
|
6
8
|
TYPE = "status"
|
7
9
|
|
8
10
|
### Public announced methods
|
9
11
|
|
10
12
|
## Common methods
|
11
13
|
|
14
|
+
# @see https://www.notion.so/hkob/StatusProperty-c8b2c83019bc42edbc1527386c7ef453#bdb34c0aeaa74729887da087d0bd8022
|
12
15
|
def status
|
13
16
|
@json
|
14
17
|
end
|
15
18
|
|
19
|
+
## Page property only methods
|
20
|
+
|
21
|
+
# @return [String]
|
22
|
+
# @see https://www.notion.so/hkob/StatusProperty-c8b2c83019bc42edbc1527386c7ef453#69452ceee6c9452296e96bb2a37460ee
|
23
|
+
def status_name
|
24
|
+
assert_page_property __method__
|
25
|
+
@json["name"]
|
26
|
+
end
|
27
|
+
|
28
|
+
## Page property only methods
|
29
|
+
|
30
|
+
# @param [String] status
|
31
|
+
# @see https://www.notion.so/hkob/StatusProperty-c8b2c83019bc42edbc1527386c7ef453#b3fba1b6322140f28308de3ba70a8b7b
|
32
|
+
def status=(status)
|
33
|
+
assert_page_property __method__
|
34
|
+
@will_update = true
|
35
|
+
@json = {"name" => status}
|
36
|
+
end
|
37
|
+
|
16
38
|
### Not public announced methods
|
17
39
|
|
18
40
|
## Common methods
|
19
41
|
|
20
42
|
# @param [String] name Property name
|
21
43
|
# @param [Boolean, Hash] json
|
22
|
-
def initialize(name, will_update: false, base_type: :page, property_cache: nil, json: {})
|
23
|
-
super name, will_update: will_update, base_type: base_type,
|
44
|
+
def initialize(name, will_update: false, base_type: :page, property_id: nil, property_cache: nil, json: {})
|
45
|
+
super name, will_update: will_update, base_type: base_type, property_id: property_id,
|
46
|
+
property_cache: property_cache
|
24
47
|
@json = json
|
25
48
|
end
|
26
49
|
|
@@ -29,8 +52,7 @@ module NotionRubyMapping
|
|
29
52
|
# @return [Hash]
|
30
53
|
def property_values_json
|
31
54
|
assert_page_property __method__
|
32
|
-
{}
|
33
|
-
#{@name => {"status" => @json, "type" => "status"}}
|
55
|
+
{@name => {"status" => @json, "type" => "status"}}
|
34
56
|
end
|
35
57
|
end
|
36
58
|
end
|
@@ -27,10 +27,12 @@ module NotionRubyMapping
|
|
27
27
|
# @param [String] name
|
28
28
|
# @param [Hash, Array] json
|
29
29
|
# @param [Array<RichTextObject>] text_objects
|
30
|
-
def initialize(name, will_update: false, base_type: :page, json: nil, text_objects: nil,
|
30
|
+
def initialize(name, will_update: false, base_type: :page, json: nil, text_objects: nil, property_id: nil,
|
31
|
+
property_cache: nil, query: nil)
|
31
32
|
raise StandardError, "TextObject is abstract class. Please use RichTextProperty." if instance_of? TextProperty
|
32
33
|
|
33
|
-
super name, will_update: will_update, base_type: base_type,
|
34
|
+
super name, will_update: will_update, base_type: base_type, property_id: property_id,
|
35
|
+
property_cache: property_cache, query: query
|
34
36
|
@text_objects = if database?
|
35
37
|
json || {}
|
36
38
|
else
|
@@ -10,8 +10,12 @@ module NotionRubyMapping
|
|
10
10
|
## Common methods
|
11
11
|
|
12
12
|
def self.rich_text_array_from_json(json)
|
13
|
-
|
14
|
-
|
13
|
+
if json["object"] == "list"
|
14
|
+
rich_text_objects = List.new(json: json, type: :property, value: self).select { true }
|
15
|
+
RichTextArray.rich_text_array "title", rich_text_objects
|
16
|
+
else
|
17
|
+
RichTextArray.new "title", json: json["title"]
|
18
|
+
end
|
15
19
|
end
|
16
20
|
|
17
21
|
# @param [Hash] json
|
@@ -34,8 +34,9 @@ module NotionRubyMapping
|
|
34
34
|
## Common methods
|
35
35
|
|
36
36
|
# @param [String] name Property name
|
37
|
-
def initialize(name, will_update: false, base_type: :page, json: nil, property_cache: nil)
|
38
|
-
super name, will_update: will_update, base_type: base_type,
|
37
|
+
def initialize(name, will_update: false, base_type: :page, json: nil, property_id: nil, property_cache: nil)
|
38
|
+
super name, will_update: will_update, base_type: base_type, property_id: property_id,
|
39
|
+
property_cache: property_cache
|
39
40
|
@json = json || (database? ? {} : nil)
|
40
41
|
end
|
41
42
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion_ruby_mapping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroyuki KOBAYASHI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|