notion_ruby_mapping 2.0.1 → 3.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -6
  3. data/exe/notionErDiagram.rb +30 -24
  4. data/lib/notion_ruby_mapping/blocks/base.rb +32 -4
  5. data/lib/notion_ruby_mapping/blocks/block.rb +0 -1
  6. data/lib/notion_ruby_mapping/blocks/column_block.rb +7 -2
  7. data/lib/notion_ruby_mapping/blocks/data_source.rb +167 -0
  8. data/lib/notion_ruby_mapping/blocks/database.rb +41 -21
  9. data/lib/notion_ruby_mapping/blocks/file_base_block.rb +3 -3
  10. data/lib/notion_ruby_mapping/blocks/list.rb +5 -5
  11. data/lib/notion_ruby_mapping/controllers/mermaid.rb +13 -13
  12. data/lib/notion_ruby_mapping/controllers/{mermaid_database.rb → mermaid_data_source.rb} +39 -39
  13. data/lib/notion_ruby_mapping/controllers/notion_cache.rb +42 -7
  14. data/lib/notion_ruby_mapping/controllers/property_cache.rb +26 -4
  15. data/lib/notion_ruby_mapping/objects/file_upload_object.rb +1 -1
  16. data/lib/notion_ruby_mapping/properties/checkbox_property.rb +1 -1
  17. data/lib/notion_ruby_mapping/properties/created_by_property.rb +2 -2
  18. data/lib/notion_ruby_mapping/properties/created_time_property.rb +1 -1
  19. data/lib/notion_ruby_mapping/properties/date_property.rb +1 -1
  20. data/lib/notion_ruby_mapping/properties/files_property.rb +2 -2
  21. data/lib/notion_ruby_mapping/properties/formula_property.rb +4 -4
  22. data/lib/notion_ruby_mapping/properties/last_edited_by_property.rb +2 -2
  23. data/lib/notion_ruby_mapping/properties/last_edited_time_property.rb +1 -1
  24. data/lib/notion_ruby_mapping/properties/multi_select_property.rb +4 -4
  25. data/lib/notion_ruby_mapping/properties/number_property.rb +4 -4
  26. data/lib/notion_ruby_mapping/properties/people_property.rb +2 -2
  27. data/lib/notion_ruby_mapping/properties/phone_number_property.rb +1 -1
  28. data/lib/notion_ruby_mapping/properties/property.rb +23 -5
  29. data/lib/notion_ruby_mapping/properties/relation_property.rb +26 -14
  30. data/lib/notion_ruby_mapping/properties/rich_text_property.rb +1 -1
  31. data/lib/notion_ruby_mapping/properties/rollup_property.rb +7 -7
  32. data/lib/notion_ruby_mapping/properties/select_property.rb +5 -5
  33. data/lib/notion_ruby_mapping/properties/text_property.rb +1 -1
  34. data/lib/notion_ruby_mapping/properties/title_property.rb +1 -1
  35. data/lib/notion_ruby_mapping/properties/unique_id_property.rb +1 -1
  36. data/lib/notion_ruby_mapping/properties/url_property.rb +1 -1
  37. data/lib/notion_ruby_mapping/version.rb +2 -2
  38. data/lib/notion_ruby_mapping.rb +3 -3
  39. data/tools/an +4 -4
  40. metadata +3 -9
  41. data/exe/erdToNotionDb.rb +0 -56
  42. data/exe/notionSitemap.rb +0 -131
  43. data/exe/notionTimeRecorder.rb +0 -284
  44. data/lib/notion_ruby_mapping/blocks/template_block.rb +0 -34
@@ -1,5 +1,5 @@
1
1
  module NotionRubyMapping
2
- class MermaidDatabase
2
+ class MermaidDataSource
3
3
  def initialize(key)
4
4
  @key = key
5
5
  @name = key
@@ -9,10 +9,10 @@ module NotionRubyMapping
9
9
  @working = []
10
10
  @relations = {}
11
11
  @relation_queue = []
12
- @real_db = nil
12
+ @real_ds = nil
13
13
  @reverse_name_queue = {}
14
14
  end
15
- attr_reader :properties, :relation_queue, :relations, :real_db, :title, :finish_flag
15
+ attr_reader :properties, :relation_queue, :relations, :real_ds, :title, :finish_flag
16
16
  attr_accessor :name
17
17
 
18
18
  def add_property(key, value)
@@ -27,8 +27,8 @@ module NotionRubyMapping
27
27
  @relation_queue << [relation, other]
28
28
  end
29
29
 
30
- def attach_database(db)
31
- @real_db = db
30
+ def attach_data_source(ds)
31
+ @real_ds = ds
32
32
  end
33
33
 
34
34
  # @param [NotionRubyMapping::Page] target_page
@@ -37,7 +37,7 @@ module NotionRubyMapping
37
37
  print "Database must have a title property"
38
38
  exit
39
39
  end
40
- @real_db = target_page.create_child_database(@name, TitleProperty, @title) do |d, _|
40
+ @real_ds = target_page.create_child_database(@name, TitleProperty, @title) do |d, _|
41
41
  d.is_inline = inline
42
42
  end
43
43
  end
@@ -55,14 +55,14 @@ module NotionRubyMapping
55
55
  end
56
56
 
57
57
  def update_title
58
- ps = @real_db.properties
58
+ ps = @real_ds.properties
59
59
  title_property = ps.select { |p| p.is_a? TitleProperty }.first
60
60
  title_property.new_name = @title unless title_property.name == @title
61
61
  @finish_flag[@title] = true
62
62
  end
63
63
 
64
64
  def update_properties
65
- ps = @real_db.properties
65
+ ps = @real_ds.properties
66
66
  @properties.each do |(value, key)|
67
67
  name, *options = value.split("|")
68
68
  next if @finish_flag[name]
@@ -76,7 +76,7 @@ module NotionRubyMapping
76
76
  last_edited_time: LastEditedTimeProperty, people: PeopleProperty, phone_number: PhoneNumberProperty,
77
77
  rich_text: RichTextProperty, url: UrlProperty, status: StatusProperty
78
78
  }[key.to_sym]
79
- @real_db.add_property klass, name unless property
79
+ @real_ds.add_property klass, name unless property
80
80
  @working << name
81
81
  when "formula"
82
82
  f_e = options.first&.gsub "@", '"'
@@ -86,7 +86,7 @@ module NotionRubyMapping
86
86
  if property
87
87
  property.formula_expression = f_e unless property.formula_expression == f_e
88
88
  else
89
- @real_db.add_property(FormulaProperty, name) { |dp| dp.formula_expression = f_e }
89
+ @real_ds.add_property(FormulaProperty, name) { |dp| dp.formula_expression = f_e }
90
90
  end
91
91
  @working << name
92
92
  else
@@ -100,7 +100,7 @@ module NotionRubyMapping
100
100
  property.add_multi_select_option name: select_name, color: "default"
101
101
  end
102
102
  else
103
- @real_db.add_property(MultiSelectProperty, name) do |dp|
103
+ @real_ds.add_property(MultiSelectProperty, name) do |dp|
104
104
  options.each do |select_name|
105
105
  dp.add_multi_select_option name: select_name, color: "default"
106
106
  end
@@ -112,7 +112,7 @@ module NotionRubyMapping
112
112
  if property
113
113
  property.format = format_value unless property.format == format_value
114
114
  else
115
- @real_db.add_property(NumberProperty, name) { |p| p.format = format_value }
115
+ @real_ds.add_property(NumberProperty, name) { |p| p.format = format_value }
116
116
  end
117
117
  @working << name
118
118
  when "rollup"
@@ -134,7 +134,7 @@ module NotionRubyMapping
134
134
  property.relation_property_name = relation_name unless property.relation_property_name == relation_name
135
135
  property.rollup_property_name = rollup_name unless property.rollup_property_name == rollup_name
136
136
  else
137
- @real_db.add_property(RollupProperty, name) do |dp|
137
+ @real_ds.add_property(RollupProperty, name) do |dp|
138
138
  dp.function = function
139
139
  dp.relation_property_name = relation_name
140
140
  dp.rollup_property_name = rollup_name
@@ -149,7 +149,7 @@ module NotionRubyMapping
149
149
  property.add_select_option name: select_name, color: "default"
150
150
  end
151
151
  else
152
- @real_db.add_property(SelectProperty, name) do |dp|
152
+ @real_ds.add_property(SelectProperty, name) do |dp|
153
153
  options.each do |select_name|
154
154
  dp.add_select_option name: select_name, color: "default"
155
155
  end
@@ -159,58 +159,58 @@ module NotionRubyMapping
159
159
  end
160
160
  end
161
161
  while (array = @relation_queue.shift)
162
- value, relation_db = array
163
- db_id = relation_db.real_db.id
162
+ value, relation_ds = array
163
+ db_is = relation_ds.real_ds.id
164
164
  forward, reverse = value.split("|").map(&:to_s)
165
165
  property = ps.values_at(forward).first
166
166
  if property
167
167
  if reverse
168
- if property.database_id == db_id && property.synced_property_name == reverse
169
- relation_db.add_property "relation", reverse
170
- relation_db.finish_flag[reverse] = true
168
+ if property.data_source_id == db_is && property.synced_property_name == reverse
169
+ relation_ds.add_property "relation", reverse
170
+ relation_ds.finish_flag[reverse] = true
171
171
  else
172
172
  unless @finish_flag[forward]
173
- property.replace_relation_database database_id: db_id
174
- relation_db.append_reverse_name_queue self, forward, reverse
173
+ property.replace_relation_data_source data_source_id: db_is
174
+ relation_ds.append_reverse_name_queue self, forward, reverse
175
175
  end
176
176
  @working << forward
177
177
  add_property "relation", forward
178
178
  end
179
- relation_db.relations[reverse] = self
179
+ relation_ds.relations[reverse] = self
180
180
  else
181
- unless property.database_id == db_id
182
- property.replace_relation_database database_id: db_id, type: "single_property"
181
+ unless property.data_source_id == db_is
182
+ property.replace_relation_data_source data_source_id: db_is, type: "single_property"
183
183
  @working << forward
184
184
  add_property "relation", forward
185
185
  end
186
186
  end
187
- @relations[forward] = relation_db
187
+ @relations[forward] = relation_ds
188
188
  else
189
- @real_db.add_property(RelationProperty, forward) do |p|
189
+ @real_ds.add_property(RelationProperty, forward) do |p|
190
190
  if reverse
191
- p.replace_relation_database database_id: relation_db.real_db.id
192
- relation_db.append_reverse_name_queue self, forward, reverse
193
- relation_db.relations[reverse] = self
191
+ p.replace_relation_data_source data_source_id: relation_ds.real_ds.id
192
+ relation_ds.append_reverse_name_queue self, forward, reverse
193
+ relation_ds.relations[reverse] = self
194
194
  else
195
- p.replace_relation_database database_id: relation_db.real_db.id, type: "single_property"
195
+ p.replace_relation_data_source data_source_id: relation_ds.real_ds.id, type: "single_property"
196
196
  end
197
197
  end
198
- @relations[forward] = relation_db
198
+ @relations[forward] = relation_ds
199
199
  @working << forward
200
200
  add_property "relation", forward
201
201
  end
202
202
  end
203
- @real_db.property_schema_json
203
+ @real_ds.property_schema_json
204
204
  end
205
205
 
206
- def append_reverse_name_queue(other_db, forward, reverse)
207
- @reverse_name_queue[reverse] = [other_db, forward]
206
+ def append_reverse_name_queue(other_ds, forward, reverse)
207
+ @reverse_name_queue[reverse] = [other_ds, forward]
208
208
  add_property "relation", reverse
209
209
  end
210
210
 
211
211
  def update_database
212
212
  update_properties
213
- @real_db.save
213
+ @real_ds.save
214
214
  while (name = @working.shift)
215
215
  @finish_flag[name] = true
216
216
  end
@@ -221,19 +221,19 @@ module NotionRubyMapping
221
221
  reverses = []
222
222
  clears = []
223
223
  @reverse_name_queue.each do |reverse, (other_db, forward)|
224
- frp = other_db.real_db.properties[forward]
224
+ frp = other_db.real_ds.properties[forward]
225
225
  rp_id = frp.synced_property_id
226
- rrp = @real_db.properties.filter { |pp| pp.property_id == rp_id }.first
226
+ rrp = @real_ds.properties.filter { |pp| pp.property_id == rp_id }.first
227
227
  if rrp && rrp.name != reverse
228
228
  rrp.new_name = reverse
229
- reverses << other_db.real_db
229
+ reverses << other_db.real_ds
230
230
  clears << rrp
231
231
  save = true
232
232
  end
233
233
  @finish_flag[reverse] = true
234
234
  end
235
235
  if save
236
- @real_db.save
236
+ @real_ds.save
237
237
  clears.map(&:clear_will_update)
238
238
  reverses.map(&:reload)
239
239
  end
@@ -124,6 +124,12 @@ module NotionRubyMapping
124
124
  request :post, databases_path, payload
125
125
  end
126
126
 
127
+ # @param [Hash] payload
128
+ # @return [Hash] response
129
+ def create_data_source_request(payload)
130
+ request :post, data_sources_path, payload
131
+ end
132
+
127
133
  # @param [Hash] payload
128
134
  # @return [Hash] response
129
135
  def create_file_upload_request(payload = {})
@@ -142,23 +148,35 @@ module NotionRubyMapping
142
148
  object_for_key(id) { database_request id }
143
149
  end
144
150
 
151
+ # @param [String] id data_source_id (with or without "-")
152
+ # @return [NotionRubyMapping::Base] DataSource object or nil
153
+ def data_source(id)
154
+ object_for_key(id) { data_source_request id }
155
+ end
156
+
145
157
  # @param [String] database_id
146
- # @return [String (frozen)] page_path
158
+ # @return [String (frozen)] database_path
147
159
  def database_path(database_id)
148
160
  "v1/databases/#{database_id}"
149
161
  end
150
162
 
163
+ # @param [String] database_id
164
+ # @return [String (frozen)] data_source_path
165
+ def data_source_path(data_source_id)
166
+ "v1/data_sources/#{data_source_id}"
167
+ end
168
+
151
169
  # @param [String] id page_id / block_id (with or without "-")
152
170
  # @param [NotionRubyMapping::Query] query query object
153
171
  # @return [NotionRubyMapping::Base] List object
154
172
  # def database_query(id, query)
155
- # Base.create_from_json database_query_request(id, query.query_json)
173
+ # Base.create_from_json data_source_query_request(id, query.query_json)
156
174
  # end
157
175
 
158
- # @param [String] database_id (with or without "-")
176
+ # @param [String] data_source_id (with or without "-")
159
177
  # @param [NotionRubyMapping::Query] query query object
160
- def database_query_request(database_id, query)
161
- request :post, "v1/databases/#{database_id}/query#{query.database_query_string}", query.query_json
178
+ def data_source_query_request(data_source_id, query)
179
+ request :post, "v1/data_sources/#{data_source_id}/query#{query.database_query_string}", query.query_json
162
180
  end
163
181
 
164
182
  # @param [String] database_id
@@ -167,11 +185,22 @@ module NotionRubyMapping
167
185
  request :get, database_path(database_id)
168
186
  end
169
187
 
188
+ # @param [String] data_source_id
189
+ # @return [Hash] response
190
+ def data_source_request(data_source_id)
191
+ request :get, data_source_path(data_source_id)
192
+ end
193
+
170
194
  # @return [String (frozen)] page_path
171
195
  def databases_path
172
196
  "v1/databases"
173
197
  end
174
198
 
199
+ # @return [String (frozen)] page_path
200
+ def data_sources_path
201
+ "v1/data_sources"
202
+ end
203
+
175
204
  # @param [String] id
176
205
  # @return [NotionRubyMapping::Base]
177
206
  def destroy_block(id)
@@ -288,8 +317,8 @@ module NotionRubyMapping
288
317
 
289
318
  # @param [String] database_id
290
319
  # @return [String (frozen)] page_path
291
- def query_database_path(database_id)
292
- "v1/databases/#{database_id}/query"
320
+ def query_data_source_path(data_source_id)
321
+ "v1/data_sources/#{data_source_id}/query"
293
322
  end
294
323
 
295
324
  # @param [String] block_id
@@ -367,6 +396,12 @@ module NotionRubyMapping
367
396
  request :patch, database_path(database_id), payload
368
397
  end
369
398
 
399
+ # @param [String] data_source_id
400
+ # @return [Hash] response
401
+ def update_data_source_request(data_source_id, payload)
402
+ request :patch, data_source_path(data_source_id), payload
403
+ end
404
+
370
405
  # @param [String] page_id
371
406
  # @param [Hash] payload
372
407
  # @return [Hash] response
@@ -11,7 +11,7 @@ module NotionRubyMapping
11
11
  @page_id = page_id
12
12
  end
13
13
  attr_writer :json
14
- attr_reader :page_id
14
+ attr_reader :page_id, :base_type
15
15
 
16
16
  # @param [String] key
17
17
  # @return [Property] Property for key
@@ -33,6 +33,21 @@ module NotionRubyMapping
33
33
  end
34
34
  end
35
35
 
36
+ # @return [TrueClass, FalseClass] true if database type
37
+ def database?
38
+ @base_type == "database"
39
+ end
40
+
41
+ # @return [TrueClass, FalseClass] true if data_source type
42
+ def data_source?
43
+ @base_type == "data_source"
44
+ end
45
+
46
+ # @return [TrueClass, FalseClass] true if database or data_source type
47
+ def database_or_data_source?
48
+ %w[database data_source].include? @base_type
49
+ end
50
+
36
51
  # @return [Hash, Enumerator]
37
52
  def each(&block)
38
53
  return enum_for(:each) unless block_given?
@@ -41,7 +56,7 @@ module NotionRubyMapping
41
56
  end
42
57
 
43
58
  def generate_all_properties
44
- if @json.empty?
59
+ if @json.nil? || @json.empty?
45
60
  @properties.values
46
61
  else
47
62
  @json.keys.map { |key| self[key] }
@@ -52,6 +67,11 @@ module NotionRubyMapping
52
67
  "PropertyCache"
53
68
  end
54
69
 
70
+ # @return [TrueClass, FalseClass] true if page type
71
+ def page?
72
+ @base_type == "page"
73
+ end
74
+
55
75
  # @return [Hash] created property values json
56
76
  def property_values_json
57
77
  @properties.each_with_object({}) do |(_, property), ans|
@@ -64,22 +84,24 @@ module NotionRubyMapping
64
84
 
65
85
  # @return [Hash] created property schema json
66
86
  def property_schema_json
67
- @properties.each_with_object({}) do |(_, property), ans|
87
+ schema = @properties.each_with_object({}) do |(_, property), ans|
68
88
  if property.will_update
69
89
  ans["properties"] ||= {}
70
90
  ans["properties"].merge! property.property_schema_json
71
91
  end
72
92
  end
93
+ database? ? {"initial_data_source" => schema} : schema
73
94
  end
74
95
 
75
96
  # @return [Hash] created update property schema json
76
97
  def update_property_schema_json
77
- @properties.each_with_object({}) do |(_, property), ans|
98
+ schema = @properties.each_with_object({}) do |(_, property), ans|
78
99
  if property.will_update
79
100
  ans["properties"] ||= {}
80
101
  ans["properties"].merge! property.update_property_schema_json
81
102
  end
82
103
  end
104
+ database? ? {"initial_data_source" => schema} : schema
83
105
  end
84
106
 
85
107
  # @param [Array] key
@@ -2,7 +2,7 @@
2
2
 
3
3
  class FileUploadObject
4
4
  MAX_SIZE = 10 * 1024 * 1024 # 10 MB
5
- # @param [String] id
5
+ # @param [String] fname
6
6
  def initialize(fname:, external_url: nil)
7
7
  @fname = fname
8
8
  if external_url
@@ -36,7 +36,7 @@ module NotionRubyMapping
36
36
  def initialize(name, will_update: false, base_type: "page", property_id: nil, property_cache: nil, json: nil)
37
37
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
38
38
  property_cache: property_cache
39
- @json = if database?
39
+ @json = if database_or_data_source?
40
40
  json || {}
41
41
  else
42
42
  json || false
@@ -26,7 +26,7 @@ module NotionRubyMapping
26
26
  property_cache: nil)
27
27
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
28
28
  property_cache: property_cache
29
- @json = if database?
29
+ @json = if database_or_data_source?
30
30
  json || {}
31
31
  else
32
32
  UserObject.new user_id: user_id, json: json
@@ -37,7 +37,7 @@ module NotionRubyMapping
37
37
  def update_from_json(json)
38
38
  @will_update = false
39
39
  cb = json["created_by"]
40
- @json = database? ? cb : UserObject.new(json: cb)
40
+ @json = database_or_data_source? ? cb : UserObject.new(json: cb)
41
41
  end
42
42
 
43
43
  ## Page property only methods
@@ -25,7 +25,7 @@ module NotionRubyMapping
25
25
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
26
26
  property_cache: property_cache
27
27
  @json = json
28
- @json ||= {} if database?
28
+ @json ||= {} if database_or_data_source?
29
29
  end
30
30
 
31
31
  ## Page property only methods
@@ -102,7 +102,7 @@ module NotionRubyMapping
102
102
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
103
103
  property_cache: property_cache
104
104
  @json = json || {}
105
- return if database?
105
+ return if database_or_data_source?
106
106
 
107
107
  @json = json || {}
108
108
  @json["start"] = start_date if start_date
@@ -40,7 +40,7 @@ module NotionRubyMapping
40
40
  property_cache: nil)
41
41
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
42
42
  property_cache: property_cache
43
- if database?
43
+ if database_or_data_source?
44
44
  @files = json || {}
45
45
  elsif json
46
46
  @files = json.map { |sub_json| FileObject.new json: sub_json }
@@ -68,7 +68,7 @@ module NotionRubyMapping
68
68
  end
69
69
 
70
70
  def update_from_json(json)
71
- return if database?
71
+ return if database_or_data_source?
72
72
 
73
73
  @files = json["files"].map { |sub_json| FileObject.new json: sub_json }
74
74
  @file_names = json["files"].map { |sub_json| sub_json["name"] }
@@ -23,14 +23,14 @@ module NotionRubyMapping
23
23
  # @return [String] formula_expression
24
24
  # @see https://www.notion.so/hkob/FormulaProperty-d6b22ca70822407a9fef0bac8925cd0d#a24d2a7b99254d2a9226c00153f1d516
25
25
  def formula_expression
26
- assert_database_property __method__
26
+ assert_database_or_data_source_property __method__
27
27
  @json["expression"]
28
28
  end
29
29
 
30
30
  # @param [String] f_e
31
31
  # @see https://www.notion.so/hkob/FormulaProperty-d6b22ca70822407a9fef0bac8925cd0d#fdb3aaa8d0474440b7ed941673ee13b7
32
32
  def formula_expression=(f_e)
33
- assert_database_property __method__
33
+ assert_database_or_data_source_property __method__
34
34
  @will_update = true
35
35
  @json["expression"] = f_e
36
36
  end
@@ -46,7 +46,7 @@ module NotionRubyMapping
46
46
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
47
47
  property_cache: property_cache
48
48
  @json = json || {}
49
- return unless database?
49
+ return unless database_or_data_source?
50
50
 
51
51
  @json["expression"] = formula if formula
52
52
  end
@@ -55,7 +55,7 @@ module NotionRubyMapping
55
55
 
56
56
  # @return [Hash]
57
57
  def update_property_schema_json
58
- assert_database_property __method__
58
+ assert_database_or_data_source_property __method__
59
59
  ans = super
60
60
  return ans if ans != {} || !@will_update
61
61
 
@@ -27,7 +27,7 @@ module NotionRubyMapping
27
27
  property_cache: nil)
28
28
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
29
29
  property_cache: property_cache
30
- @json = if database?
30
+ @json = if database_or_data_source?
31
31
  json || {}
32
32
  else
33
33
  UserObject.new user_id: user_id, json: json
@@ -39,7 +39,7 @@ module NotionRubyMapping
39
39
  def update_from_json(json)
40
40
  @will_update = false
41
41
  leb = json["last_edited_by"]
42
- @json = database? ? leb : UserObject.new(json: leb)
42
+ @json = database_or_data_source? ? leb : UserObject.new(json: leb)
43
43
  end
44
44
 
45
45
  ## Page property only methods
@@ -25,7 +25,7 @@ module NotionRubyMapping
25
25
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
26
26
  property_cache: property_cache
27
27
  @json = json
28
- @json ||= {} if database?
28
+ @json ||= {} if database_or_data_source?
29
29
  end
30
30
 
31
31
  ## Page property only methods
@@ -32,7 +32,7 @@ module NotionRubyMapping
32
32
 
33
33
  # @return [Array] copyed multi select options
34
34
  def edit_multi_select_options
35
- assert_database_property __method__
35
+ assert_database_or_data_source_property __method__
36
36
  @will_update = true
37
37
  @json["options"] ||= []
38
38
  end
@@ -40,7 +40,7 @@ module NotionRubyMapping
40
40
  # @return [Array]
41
41
  # @see https://www.notion.so/hkob/MultiSelectProperty-b90bba1c55d540ba97131bb013d4ca74#5ff6ec299cf64049bde2416f61b30fa9
42
42
  def multi_select_options
43
- assert_database_property __method__
43
+ assert_data_source_property __method__
44
44
  @json["options"] || []
45
45
  end
46
46
 
@@ -65,7 +65,7 @@ module NotionRubyMapping
65
65
  property_id: nil, property_cache: nil)
66
66
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
67
67
  property_cache: property_cache
68
- if database?
68
+ if database_or_data_source?
69
69
  @json = json || {"options" => []}
70
70
  else
71
71
  @json = json || []
@@ -77,7 +77,7 @@ module NotionRubyMapping
77
77
 
78
78
  # @return [Hash]
79
79
  def update_property_schema_json
80
- assert_database_property __method__
80
+ assert_database_or_data_source_property __method__
81
81
  ans = super
82
82
  return ans if ans != {} || !@will_update
83
83
 
@@ -23,7 +23,7 @@ module NotionRubyMapping
23
23
  # @return [String] new or settled format
24
24
  # @see https://www.notion.so/hkob/NumberProperty-964ebc1948074d7ca8340187aa352d40#5e3682ed9e124d518f735b236787d7a7
25
25
  def format
26
- assert_database_property __method__
26
+ assert_database_or_data_source_property __method__
27
27
  @json["format"]
28
28
  end
29
29
 
@@ -31,7 +31,7 @@ module NotionRubyMapping
31
31
  # @return [String] settled format
32
32
  # @see https://www.notion.so/hkob/NumberProperty-964ebc1948074d7ca8340187aa352d40#89695432078643e48307c348e2983456
33
33
  def format=(format)
34
- assert_database_property __method__
34
+ assert_database_or_data_source_property __method__
35
35
  @will_update = true
36
36
  @json["format"] = format
37
37
  end
@@ -58,7 +58,7 @@ module NotionRubyMapping
58
58
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
59
59
  property_cache: property_cache
60
60
  @json = json
61
- @json ||= {"format" => format || "number"} if database?
61
+ @json ||= {"format" => format || "number"} if database_or_data_source?
62
62
  end
63
63
 
64
64
  # @param [Hash] json
@@ -73,7 +73,7 @@ module NotionRubyMapping
73
73
 
74
74
  # @return [Hash]
75
75
  def update_property_schema_json
76
- assert_database_property __method__
76
+ assert_database_or_data_source_property __method__
77
77
  ans = super
78
78
  return ans if ans != {} || !@will_update
79
79
 
@@ -56,7 +56,7 @@ module NotionRubyMapping
56
56
  property_cache: nil, query: nil)
57
57
  super name, will_update: will_update, base_type: base_type, property_id: property_id,
58
58
  property_cache: property_cache, query: query
59
- @json = if database?
59
+ @json = if database_or_data_source?
60
60
  {}
61
61
  elsif people
62
62
  Array(people).map { |uo| UserObject.user_object(uo) }
@@ -84,7 +84,7 @@ module NotionRubyMapping
84
84
  # @return [Hash, Array]
85
85
  def update_from_json(json)
86
86
  @will_update = false
87
- @json = database? ? {} : PeopleProperty.people_from_json(json)
87
+ @json = database_or_data_source? ? {} : PeopleProperty.people_from_json(json)
88
88
  end
89
89
  end
90
90
  end
@@ -37,7 +37,7 @@ module NotionRubyMapping
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
40
- @json = database? ? {} : json
40
+ @json = database_or_data_source? ? {} : json
41
41
  end
42
42
 
43
43
  ## Page property only methods