notion_ruby_mapping 0.6.6 → 0.6.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.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -0
  3. data/lib/notion_ruby_mapping/blocks/heading1_block.rb +8 -0
  4. data/lib/notion_ruby_mapping/blocks/heading2_block.rb +8 -0
  5. data/lib/notion_ruby_mapping/blocks/heading3_block.rb +8 -0
  6. data/lib/notion_ruby_mapping/blocks/page.rb +2 -2
  7. data/lib/notion_ruby_mapping/blocks/toggle_heading1_block.rb +8 -0
  8. data/lib/notion_ruby_mapping/blocks/toggle_heading2_block.rb +8 -0
  9. data/lib/notion_ruby_mapping/blocks/toggle_heading3_block.rb +8 -0
  10. data/lib/notion_ruby_mapping/controllers/property_cache.rb +4 -0
  11. data/lib/notion_ruby_mapping/properties/checkbox_property.rb +3 -2
  12. data/lib/notion_ruby_mapping/properties/created_by_property.rb +4 -2
  13. data/lib/notion_ruby_mapping/properties/created_time_property.rb +3 -2
  14. data/lib/notion_ruby_mapping/properties/date_property.rb +4 -2
  15. data/lib/notion_ruby_mapping/properties/email_property.rb +3 -2
  16. data/lib/notion_ruby_mapping/properties/files_property.rb +4 -2
  17. data/lib/notion_ruby_mapping/properties/formula_property.rb +4 -2
  18. data/lib/notion_ruby_mapping/properties/last_edited_by_property.rb +4 -2
  19. data/lib/notion_ruby_mapping/properties/last_edited_time_property.rb +3 -2
  20. data/lib/notion_ruby_mapping/properties/multi_select_property.rb +4 -2
  21. data/lib/notion_ruby_mapping/properties/number_property.rb +4 -2
  22. data/lib/notion_ruby_mapping/properties/people_property.rb +11 -3
  23. data/lib/notion_ruby_mapping/properties/phone_number_property.rb +3 -2
  24. data/lib/notion_ruby_mapping/properties/property.rb +12 -6
  25. data/lib/notion_ruby_mapping/properties/relation_property.rb +4 -2
  26. data/lib/notion_ruby_mapping/properties/rollup_property.rb +4 -2
  27. data/lib/notion_ruby_mapping/properties/select_property.rb +4 -2
  28. data/lib/notion_ruby_mapping/properties/status_property.rb +26 -4
  29. data/lib/notion_ruby_mapping/properties/text_property.rb +4 -2
  30. data/lib/notion_ruby_mapping/properties/title_property.rb +6 -2
  31. data/lib/notion_ruby_mapping/properties/url_property.rb +3 -2
  32. data/lib/notion_ruby_mapping/version.rb +1 -1
  33. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1a2aa2a4c8880559f3a314967335cfd4f008b9884890111b6d5edfcb0f6251c
4
- data.tar.gz: 52ece830f67e3373f653f60dcee81b1076c5ab095eb9d53bb4d0e3340c76bc7c
3
+ metadata.gz: b9297c2ca59117bacfab46da55e60bda063c3a08a1bfc0acdd5b8e9b7b029c52
4
+ data.tar.gz: fdcfc87ab82132cebedf50f99c174793c74e952cc35608b60935e2bd158a2df6
5
5
  SHA512:
6
- metadata.gz: 7b70e9092468ef61744ec120e499402daf214e35d5c86158d4b44fc3fb9d7262e6d5b82e6763b20554f843996a9d614bd181b09baad66f2533fa1a076b15555b
7
- data.tar.gz: e618b6066d6d17e4564cdfbadda3b3f0d7b598740f5b3ed1c2a9c2b640d28284cfa8ecfc1676fb0de6be0d604cd24670856ce112e049fbe5a91ac44b4404b05b
6
+ metadata.gz: 0f01ba2a798cd79e608b244a6c9c0157f92b1f7e2f9bd4fd4772b38e60f708d1da5a70ffda0816b8aa136282da49d118ff04ede19a363674c3277b3095a34e91
7
+ data.tar.gz: 6135423f52bdc33585247ef2c144a49492b54a28d18ae7429d8f4df9791f4d4189d570c2b381b89f939d0b2e2e1914276172b603f612038dbfc7c495ea250c01
data/README.md CHANGED
@@ -92,6 +92,7 @@ NotionCache.instance.create_client ENV["NOTION_API_TOKEN"] # from environment
92
92
 
93
93
  ## 3. ChangeLog
94
94
 
95
+ - 2022/9/2 [v0.6.7] add support for Status property, is_toggleable for headings block, and page property values
95
96
  - 2022/8/10 [v0.6.6] Bug fix(notionSitemap.rb): Skip if child page is empty.
96
97
  - 2022/8/10 [v0.6.5] add notionSitemap.rb, rename createErDiagram to notionErDiagram, and move them to exe directory
97
98
  - 2022/8/9 [v0.6.4] url can be entered instead of page_id, block_id and database_id
@@ -14,5 +14,13 @@ module NotionRubyMapping
14
14
  def type
15
15
  "heading_1"
16
16
  end
17
+
18
+ # @param [Boolean] not_update false when update
19
+ # @return [Hash{String (frozen)->Hash}]
20
+ def block_json(not_update: true)
21
+ ans = super
22
+ ans[type]["is_toggleable"] = false
23
+ ans
24
+ end
17
25
  end
18
26
  end
@@ -14,5 +14,13 @@ module NotionRubyMapping
14
14
  def type
15
15
  "heading_2"
16
16
  end
17
+
18
+ # @param [Boolean] not_update false when update
19
+ # @return [Hash{String (frozen)->Hash}]
20
+ def block_json(not_update: true)
21
+ ans = super
22
+ ans[type]["is_toggleable"] = false
23
+ ans
24
+ end
17
25
  end
18
26
  end
@@ -14,5 +14,13 @@ module NotionRubyMapping
14
14
  def type
15
15
  "heading_3"
16
16
  end
17
+
18
+ # @param [Boolean] not_update false when update
19
+ # @return [Hash{String (frozen)->Hash}]
20
+ def block_json(not_update: true)
21
+ ans = super
22
+ ans[type]["is_toggleable"] = false
23
+ ans
24
+ end
17
25
  end
18
26
  end
@@ -47,7 +47,7 @@ module NotionRubyMapping
47
47
 
48
48
  # @param [String] title
49
49
  # @param [Array<String, Property>] assigns
50
- # @return [NotionRubyMapping::Database]
50
+ # @return [NotionRubyMapping::Database, String]
51
51
  # @see https://www.notion.so/hkob/Page-d359650e3ca94424af8359a24147b9a0#e3f1d21e0f724f589e48431468772eed
52
52
  def create_child_database(title, *assigns, dry_run: false)
53
53
  build_child_database(title, *assigns).save dry_run: dry_run
@@ -56,7 +56,7 @@ module NotionRubyMapping
56
56
  # @return [String] title
57
57
  # @see https://www.notion.so/hkob/Page-d359650e3ca94424af8359a24147b9a0#2ff7209055f346fbbda454cdbb40b1c8
58
58
  def title
59
- tp = properties.select { |p| (p.is_a?(TitleProperty)) || (p.is_a?(Property) && p.property_id == "title") }
59
+ tp = properties.select { |p| p.is_a?(TitleProperty) || (p.is_a?(Property) && p.property_id == "title") }
60
60
  tp.map(&:full_text).join ""
61
61
  end
62
62
 
@@ -7,5 +7,13 @@ module NotionRubyMapping
7
7
  def type
8
8
  "heading_1"
9
9
  end
10
+
11
+ # @param [Boolean] not_update false when update
12
+ # @return [Hash{String (frozen)->Hash}]
13
+ def block_json(not_update: true)
14
+ ans = super
15
+ ans[type]["is_toggleable"] = true
16
+ ans
17
+ end
10
18
  end
11
19
  end
@@ -7,5 +7,13 @@ module NotionRubyMapping
7
7
  def type
8
8
  "heading_2"
9
9
  end
10
+
11
+ # @param [Boolean] not_update false when update
12
+ # @return [Hash{String (frozen)->Hash}]
13
+ def block_json(not_update: true)
14
+ ans = super
15
+ ans[type]["is_toggleable"] = true
16
+ ans
17
+ end
10
18
  end
11
19
  end
@@ -7,5 +7,13 @@ module NotionRubyMapping
7
7
  def type
8
8
  "heading_3"
9
9
  end
10
+
11
+ # @param [Boolean] not_update false when update
12
+ # @return [Hash{String (frozen)->Hash}]
13
+ def block_json(not_update: true)
14
+ ans = super
15
+ ans[type]["is_toggleable"] = true
16
+ ans
17
+ end
10
18
  end
11
19
  end
@@ -48,6 +48,10 @@ module NotionRubyMapping
48
48
  end
49
49
  end
50
50
 
51
+ def inspect
52
+ "PropertyCache"
53
+ end
54
+
51
55
  # @return [Hash] created property values json
52
56
  def property_values_json
53
57
  @properties.each_with_object({}) do |(_, property), ans|
@@ -33,8 +33,9 @@ module NotionRubyMapping
33
33
 
34
34
  # @param [String] name Property name
35
35
  # @param [Boolean, Hash] json
36
- def initialize(name, will_update: false, base_type: :page, property_cache: nil, json: nil)
37
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
36
+ def initialize(name, will_update: false, base_type: :page, property_id: nil, property_cache: nil, json: nil)
37
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
38
+ property_cache: property_cache
38
39
  @json = if database?
39
40
  json || {}
40
41
  else
@@ -22,8 +22,10 @@ module NotionRubyMapping
22
22
  # @param [String] name Property name
23
23
  # @param [String] user_id user_id (optional)
24
24
  # @param [Hash] json json (optional)
25
- def initialize(name, will_update: false, base_type: :page, json: nil, user_id: nil, property_cache: nil)
26
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
25
+ def initialize(name, will_update: false, base_type: :page, json: nil, user_id: nil, property_id: nil,
26
+ property_cache: nil)
27
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
28
+ property_cache: property_cache
27
29
  @json = if database?
28
30
  json || {}
29
31
  else
@@ -21,8 +21,9 @@ module NotionRubyMapping
21
21
 
22
22
  # @param [String] name Property name
23
23
  # @param [String] json created_time value (optional)
24
- def initialize(name, will_update: false, base_type: :page, json: nil, property_cache: nil)
25
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
24
+ def initialize(name, will_update: false, base_type: :page, json: nil, property_id: nil, property_cache: nil)
25
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
26
+ property_cache: property_cache
26
27
  @json = json
27
28
  @json ||= {} if database?
28
29
  end
@@ -75,8 +75,10 @@ module NotionRubyMapping
75
75
  # @param [Date, Time, DateTime, String, nil] start_date
76
76
  # @param [Date, Time, DateTime, String, nil] end_date
77
77
  # @param [String, nil] time_zone
78
- def initialize(name, will_update: false, base_type: :page, json: nil, start_date: nil, end_date: nil, time_zone: nil, property_cache: nil)
79
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
78
+ def initialize(name, will_update: false, base_type: :page, json: nil, start_date: nil, end_date: nil,
79
+ time_zone: nil, property_id: nil, property_cache: nil)
80
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
81
+ property_cache: property_cache
80
82
  @json = json || {}
81
83
  return if database?
82
84
 
@@ -32,8 +32,9 @@ module NotionRubyMapping
32
32
  ## Common methods
33
33
 
34
34
  # @param [String] name Property name
35
- def initialize(name, will_update: false, base_type: :page, json: nil, property_cache: nil)
36
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
35
+ def initialize(name, will_update: false, base_type: :page, json: nil, property_id: nil, property_cache: nil)
36
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
37
+ property_cache: property_cache
37
38
  @json = json || {}
38
39
  end
39
40
 
@@ -33,8 +33,10 @@ module NotionRubyMapping
33
33
 
34
34
  # @param [String] name Property name
35
35
  # @param [String] files files value (optional)
36
- def initialize(name, will_update: false, base_type: :page, json: nil, files: [], property_cache: nil)
37
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
36
+ def initialize(name, will_update: false, base_type: :page, json: nil, files: [], property_id: nil,
37
+ property_cache: nil)
38
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
39
+ property_cache: property_cache
38
40
  if database?
39
41
  @files = json || {}
40
42
  elsif json
@@ -41,8 +41,10 @@ module NotionRubyMapping
41
41
 
42
42
  # @param [String] name
43
43
  # @param [Hash] json
44
- def initialize(name, will_update: false, base_type: :page, json: nil, formula: nil, property_cache: nil)
45
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
44
+ def initialize(name, will_update: false, base_type: :page, json: nil, formula: nil, property_id: nil,
45
+ property_cache: nil)
46
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
47
+ property_cache: property_cache
46
48
  @json = json || {}
47
49
  return unless database?
48
50
 
@@ -22,8 +22,10 @@ module NotionRubyMapping
22
22
  # @param [String] name Property name
23
23
  # @param [String] user_id user_id (optional)
24
24
  # @param [Hash] json json (optional)
25
- def initialize(name, will_update: false, base_type: :page, json: nil, user_id: nil, property_cache: nil)
26
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
25
+ def initialize(name, will_update: false, base_type: :page, json: nil, user_id: nil, property_id: nil,
26
+ property_cache: nil)
27
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
28
+ property_cache: property_cache
27
29
  @json = if database?
28
30
  json || {}
29
31
  else
@@ -21,8 +21,9 @@ module NotionRubyMapping
21
21
 
22
22
  # @param [String] name Property name
23
23
  # @param [String] json last_edited_time value (optional)
24
- def initialize(name, will_update: false, base_type: :page, json: nil, property_cache: nil)
25
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
24
+ def initialize(name, will_update: false, base_type: :page, json: nil, property_id: nil, property_cache: nil)
25
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
26
+ property_cache: property_cache
26
27
  @json = json
27
28
  @json ||= {} if database?
28
29
  end
@@ -61,8 +61,10 @@ module NotionRubyMapping
61
61
  # @param [String] name
62
62
  # @param [Hash] json
63
63
  # @param [Array<String>, String] multi_select
64
- def initialize(name, will_update: false, base_type: :page, json: nil, multi_select: nil, property_cache: nil)
65
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
64
+ def initialize(name, will_update: false, base_type: :page, json: nil, multi_select: nil,
65
+ property_id: nil, property_cache: nil)
66
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
67
+ property_cache: property_cache
66
68
  if database?
67
69
  @json = json || {"options" => []}
68
70
  else
@@ -53,8 +53,10 @@ module NotionRubyMapping
53
53
 
54
54
  # @param [String] name Property name
55
55
  # @param [Float, Integer, Hash] json Number value or format Hash
56
- def initialize(name, will_update: false, base_type: :page, json: nil, format: nil, property_cache: nil)
57
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
56
+ def initialize(name, will_update: false, base_type: :page, json: nil, format: nil, property_id: nil,
57
+ property_cache: nil)
58
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
59
+ property_cache: property_cache
58
60
  @json = json
59
61
  @json ||= {"format" => (format || "number")} if database?
60
62
  end
@@ -40,14 +40,22 @@ module NotionRubyMapping
40
40
  ## Common methods
41
41
 
42
42
  def self.people_from_json(json)
43
- List.new(json: json, property: self).select { true }
43
+ if json.is_a? Array
44
+ json.map { |sub_json| UserObject.new json: sub_json }
45
+ elsif json["object"] == "list"
46
+ List.new(json: json, property: self).select { true }
47
+ else
48
+ json["people"].map { |sub_json| UserObject.new json: sub_json }
49
+ end
44
50
  end
45
51
 
46
52
  # @param [String] name
47
53
  # @param [Hash] json
48
54
  # @param [Array] people ids for people
49
- def initialize(name, will_update: false, base_type: :page, json: nil, people: nil, property_cache: nil, query: nil)
50
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache, query: query
55
+ def initialize(name, will_update: false, base_type: :page, json: nil, people: nil, property_id: nil,
56
+ property_cache: nil, query: nil)
57
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
58
+ property_cache: property_cache, query: query
51
59
  @json = if database?
52
60
  {}
53
61
  elsif people
@@ -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, property_cache: property_cache
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 = database? ? {} : json
40
41
  end
41
42
 
@@ -79,15 +79,20 @@ module NotionRubyMapping
79
79
  objects = List.new(json: input_json, property: tmp, query: query).select { true }
80
80
  case input_json["property_item"]["type"]
81
81
  when "people"
82
- PeopleProperty.new name, people: objects, base_type: base_type, property_cache: property_cache, query: query
82
+ PeopleProperty.new name, people: objects, base_type: base_type,
83
+ property_cache: property_cache, query: query
83
84
  when "relation"
84
- RelationProperty.new name, relation: objects, base_type: base_type, property_cache: property_cache, query: query
85
+ RelationProperty.new name, relation: objects, base_type: base_type,
86
+ property_cache: property_cache, query: query
85
87
  when "rich_text"
86
- RichTextProperty.new name, text_objects: objects, base_type: base_type, property_cache: property_cache, query: query
88
+ RichTextProperty.new name, text_objects: objects, base_type: base_type,
89
+ property_cache: property_cache, query: query
87
90
  when "rollup"
88
- RollupProperty.new name, json: objects, base_type: base_type, property_cache: property_cache, query: query
91
+ RollupProperty.new name, json: objects, base_type: base_type,
92
+ property_cache: property_cache, query: query
89
93
  when "title"
90
- TitleProperty.new name, text_objects: objects, base_type: base_type, property_cache: property_cache, query: query
94
+ TitleProperty.new name, text_objects: objects, base_type: base_type,
95
+ property_cache: property_cache, query: query
91
96
  end
92
97
  else
93
98
  klass = {
@@ -114,7 +119,8 @@ module NotionRubyMapping
114
119
  }[type]
115
120
  raise StandardError, "Irregular property type: #{type}" unless klass
116
121
 
117
- klass.new name, json: input_json[type], base_type: base_type, property_cache: property_cache
122
+ klass.new name, property_id: input_json["id"], json: input_json[type], base_type: base_type,
123
+ property_cache: property_cache
118
124
  end
119
125
  end
120
126
 
@@ -70,8 +70,10 @@ module NotionRubyMapping
70
70
  # @param [String] name
71
71
  # @param [Hash, Array] json
72
72
  # @param [String, Array] relation
73
- def initialize(name, will_update: false, json: nil, relation: nil, base_type: :page, property_cache: nil, query: nil)
74
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache, query: query
73
+ def initialize(name, will_update: false, json: nil, relation: nil, base_type: :page, property_id: nil,
74
+ property_cache: nil, query: nil)
75
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
76
+ property_cache: property_cache, query: query
75
77
  @json = if database?
76
78
  json || {}
77
79
  elsif relation
@@ -71,8 +71,10 @@ module NotionRubyMapping
71
71
 
72
72
  # @param [String] name
73
73
  # @param [Hash] json
74
- def initialize(name, will_update: false, json: nil, base_type: :page, property_cache: nil, query: nil)
75
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache, query: query
74
+ def initialize(name, will_update: false, json: nil, base_type: :page, property_id: nil,
75
+ property_cache: nil, query: nil)
76
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
77
+ property_cache: property_cache, query: query
76
78
  @json = json || {}
77
79
  end
78
80
 
@@ -74,8 +74,10 @@ module NotionRubyMapping
74
74
  # @param [String] name Property name
75
75
  # @param [Hash] json
76
76
  # @param [String] select String value (optional)
77
- def initialize(name, will_update: false, base_type: :page, json: nil, select: nil, property_cache: nil)
78
- super name, will_update: will_update, base_type: base_type, property_cache: property_cache
77
+ def initialize(name, will_update: false, base_type: :page, json: nil, select: nil, property_id: nil,
78
+ property_cache: nil)
79
+ super name, will_update: will_update, base_type: base_type, property_id: property_id,
80
+ property_cache: property_cache
79
81
  @json = if database?
80
82
  json || {"options" => []}
81
83
  else
@@ -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, property_cache: property_cache
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, property_cache: nil, query: 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, property_cache: property_cache, query: query
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
- rich_text_objects = List.new(json: json, property: self).select { true }
14
- RichTextArray.rich_text_array "title", rich_text_objects
13
+ if json["object"] == "list"
14
+ rich_text_objects = List.new(json: json, property: 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, property_cache: property_cache
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
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NotionRubyMapping
4
- VERSION = "0.6.6"
4
+ VERSION = "0.6.7"
5
5
  NOTION_VERSION = "2022-06-28"
6
6
  end
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.6
4
+ version: 0.6.7
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-08-10 00:00:00.000000000 Z
11
+ date: 2022-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday