notion_ruby_mapping 0.3.3 → 0.5.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 (90) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -1237
  3. data/env.yml.sample +0 -13
  4. data/examples/change_title.md +1 -1
  5. data/examples/renumbering_pages.md +3 -3
  6. data/examples/set_icon_to_all_icon_unsettled_pages.md +4 -4
  7. data/lib/notion_ruby_mapping/{base.rb → blocks/base.rb} +163 -92
  8. data/lib/notion_ruby_mapping/blocks/block.rb +145 -0
  9. data/lib/notion_ruby_mapping/blocks/bookmark_block.rb +11 -0
  10. data/lib/notion_ruby_mapping/blocks/breadcrumb_block.rb +19 -0
  11. data/lib/notion_ruby_mapping/blocks/bulleted_list_item_block.rb +11 -0
  12. data/lib/notion_ruby_mapping/blocks/callout_block.rb +82 -0
  13. data/lib/notion_ruby_mapping/blocks/child_base_block.rb +21 -0
  14. data/lib/notion_ruby_mapping/blocks/child_database_block.rb +11 -0
  15. data/lib/notion_ruby_mapping/blocks/child_page_block.rb +11 -0
  16. data/lib/notion_ruby_mapping/blocks/code_block.rb +50 -0
  17. data/lib/notion_ruby_mapping/blocks/column_block.rb +29 -0
  18. data/lib/notion_ruby_mapping/blocks/column_list_block.rb +33 -0
  19. data/lib/notion_ruby_mapping/{database.rb → blocks/database.rb} +41 -8
  20. data/lib/notion_ruby_mapping/blocks/divider_block.rb +19 -0
  21. data/lib/notion_ruby_mapping/blocks/embed_block.rb +11 -0
  22. data/lib/notion_ruby_mapping/blocks/equation_block.rb +43 -0
  23. data/lib/notion_ruby_mapping/blocks/file_base_block.rb +50 -0
  24. data/lib/notion_ruby_mapping/blocks/file_block.rb +11 -0
  25. data/lib/notion_ruby_mapping/blocks/heading1_block.rb +18 -0
  26. data/lib/notion_ruby_mapping/blocks/heading2_block.rb +18 -0
  27. data/lib/notion_ruby_mapping/blocks/heading3_block.rb +18 -0
  28. data/lib/notion_ruby_mapping/blocks/image_block.rb +11 -0
  29. data/lib/notion_ruby_mapping/blocks/link_preview_block.rb +16 -0
  30. data/lib/notion_ruby_mapping/blocks/link_to_page_block.rb +40 -0
  31. data/lib/notion_ruby_mapping/{list.rb → blocks/list.rb} +37 -6
  32. data/lib/notion_ruby_mapping/blocks/numbered_list_item_block.rb +11 -0
  33. data/lib/notion_ruby_mapping/blocks/page.rb +77 -0
  34. data/lib/notion_ruby_mapping/blocks/paragraph_block.rb +11 -0
  35. data/lib/notion_ruby_mapping/{block.rb → blocks/pdf_block.rb} +4 -3
  36. data/lib/notion_ruby_mapping/blocks/quote_block.rb +11 -0
  37. data/lib/notion_ruby_mapping/blocks/synced_block.rb +44 -0
  38. data/lib/notion_ruby_mapping/blocks/table_block.rb +50 -0
  39. data/lib/notion_ruby_mapping/blocks/table_of_contents_block.rb +34 -0
  40. data/lib/notion_ruby_mapping/blocks/table_row_block.rb +34 -0
  41. data/lib/notion_ruby_mapping/blocks/template_block.rb +34 -0
  42. data/lib/notion_ruby_mapping/blocks/text_sub_block_color_base_block.rb +45 -0
  43. data/lib/notion_ruby_mapping/blocks/to_do_block.rb +42 -0
  44. data/lib/notion_ruby_mapping/blocks/toggle_block.rb +11 -0
  45. data/lib/notion_ruby_mapping/blocks/toggle_heading1_block.rb +11 -0
  46. data/lib/notion_ruby_mapping/blocks/toggle_heading2_block.rb +11 -0
  47. data/lib/notion_ruby_mapping/blocks/toggle_heading3_block.rb +11 -0
  48. data/lib/notion_ruby_mapping/blocks/url_base_block.rb +34 -0
  49. data/lib/notion_ruby_mapping/blocks/url_caption_base_block.rb +46 -0
  50. data/lib/notion_ruby_mapping/blocks/video_block.rb +11 -0
  51. data/lib/notion_ruby_mapping/{notion_cache.rb → controllers/notion_cache.rb} +144 -102
  52. data/lib/notion_ruby_mapping/{payload.rb → controllers/payload.rb} +32 -18
  53. data/lib/notion_ruby_mapping/{property_cache.rb → controllers/property_cache.rb} +21 -20
  54. data/lib/notion_ruby_mapping/{query.rb → controllers/query.rb} +27 -19
  55. data/lib/notion_ruby_mapping/{rich_text_array.rb → controllers/rich_text_array.rb} +39 -17
  56. data/lib/notion_ruby_mapping/objects/emoji_object.rb +40 -0
  57. data/lib/notion_ruby_mapping/objects/equation_object.rb +43 -0
  58. data/lib/notion_ruby_mapping/objects/file_object.rb +60 -0
  59. data/lib/notion_ruby_mapping/{mention_object.rb → objects/mention_object.rb} +11 -0
  60. data/lib/notion_ruby_mapping/{rich_text_object.rb → objects/rich_text_object.rb} +12 -4
  61. data/lib/notion_ruby_mapping/{text_object.rb → objects/text_object.rb} +0 -1
  62. data/lib/notion_ruby_mapping/{user_object.rb → objects/user_object.rb} +9 -4
  63. data/lib/notion_ruby_mapping/{checkbox_property.rb → properties/checkbox_property.rb} +3 -0
  64. data/lib/notion_ruby_mapping/{created_by_property.rb → properties/created_by_property.rb} +1 -0
  65. data/lib/notion_ruby_mapping/{created_time_property.rb → properties/created_time_property.rb} +1 -0
  66. data/lib/notion_ruby_mapping/properties/date_base_property.rb +135 -0
  67. data/lib/notion_ruby_mapping/{date_property.rb → properties/date_property.rb} +13 -0
  68. data/lib/notion_ruby_mapping/{email_property.rb → properties/email_property.rb} +2 -2
  69. data/lib/notion_ruby_mapping/{files_property.rb → properties/files_property.rb} +26 -13
  70. data/lib/notion_ruby_mapping/{formula_property.rb → properties/formula_property.rb} +5 -1
  71. data/lib/notion_ruby_mapping/{last_edited_by_property.rb → properties/last_edited_by_property.rb} +1 -0
  72. data/lib/notion_ruby_mapping/{last_edited_time_property.rb → properties/last_edited_time_property.rb} +1 -0
  73. data/lib/notion_ruby_mapping/{multi_property.rb → properties/multi_property.rb} +0 -0
  74. data/lib/notion_ruby_mapping/{multi_select_property.rb → properties/multi_select_property.rb} +4 -3
  75. data/lib/notion_ruby_mapping/{number_property.rb → properties/number_property.rb} +4 -0
  76. data/lib/notion_ruby_mapping/{people_property.rb → properties/people_property.rb} +8 -3
  77. data/lib/notion_ruby_mapping/{phone_number_property.rb → properties/phone_number_property.rb} +4 -1
  78. data/lib/notion_ruby_mapping/{property.rb → properties/property.rb} +33 -0
  79. data/lib/notion_ruby_mapping/{relation_property.rb → properties/relation_property.rb} +30 -10
  80. data/lib/notion_ruby_mapping/{rich_text_property.rb → properties/rich_text_property.rb} +0 -0
  81. data/lib/notion_ruby_mapping/{rollup_property.rb → properties/rollup_property.rb} +7 -0
  82. data/lib/notion_ruby_mapping/{select_property.rb → properties/select_property.rb} +8 -2
  83. data/lib/notion_ruby_mapping/{text_property.rb → properties/text_property.rb} +0 -0
  84. data/lib/notion_ruby_mapping/{title_property.rb → properties/title_property.rb} +0 -0
  85. data/lib/notion_ruby_mapping/{url_property.rb → properties/url_property.rb} +4 -1
  86. data/lib/notion_ruby_mapping/version.rb +1 -1
  87. data/lib/notion_ruby_mapping.rb +21 -7
  88. metadata +82 -40
  89. data/lib/notion_ruby_mapping/date_base_property.rb +0 -75
  90. data/lib/notion_ruby_mapping/page.rb +0 -50
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class ParagraphBlock < TextSubBlockColorBaseBlock
6
+ # @return [String (frozen)]
7
+ def type
8
+ "paragraph"
9
+ end
10
+ end
11
+ end
@@ -2,9 +2,10 @@
2
2
 
3
3
  module NotionRubyMapping
4
4
  # Notion block
5
- class Block < Base
6
- def self.find(key)
7
- NotionCache.instance.block key
5
+ class PdfBlock < FileBaseBlock
6
+ # @return [String (frozen)]
7
+ def type
8
+ "pdf"
8
9
  end
9
10
  end
10
11
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class QuoteBlock < TextSubBlockColorBaseBlock
6
+ # @return [String (frozen)]
7
+ def type
8
+ "quote"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class SyncedBlock < Block
6
+ # @param [String] block_id
7
+ # @param [NotionRubyMapping::Block, Array<NotionRubyMapping::Block>, nil] sub_blocks
8
+ def initialize(block_id: nil, sub_blocks: nil, json: nil, id: nil, parent: nil)
9
+ super json: json, id: id, parent: parent
10
+ if @json
11
+ synced_from = @json[type]["synced_from"]
12
+ @block_id = synced_from && @nc.hex_id(synced_from["block_id"])
13
+ else
14
+ @block_id = block_id
15
+ add_sub_blocks sub_blocks
16
+ end
17
+ @can_have_children = @block_id.nil?
18
+ end
19
+
20
+ attr_reader :block_id
21
+
22
+ def block_json(not_update: true)
23
+ ans = super
24
+ ans[type] = {"synced_from" => @block_id ? {"type" => "block_id", "block_id" => @nc.hex_id(@block_id)} : nil}
25
+ ans[type]["children"] = @sub_blocks.map(&:block_json) if @sub_blocks
26
+ ans
27
+ end
28
+
29
+ # @return [Boolean] true if synced_block & block_id is nil
30
+ def synced_block_original?
31
+ @type == "synced_block" && @block_id.nil?
32
+ end
33
+
34
+ # @return [String, nil]
35
+ def synced_block_original_id
36
+ @type == "synced_block" && @block_id
37
+ end
38
+
39
+ # @return [String (frozen)]
40
+ def type
41
+ "synced_block"
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class TableBlock < Block
6
+ # @param [Integer] table_width
7
+ # @param [Boolean] has_column_header
8
+ # @param [Boolean] has_row_header
9
+ # @param [Array<Array<Object>>] table_rows
10
+ # @param [Hash] json
11
+ # @param [Integer] id
12
+ # @param [Integer] parent
13
+ def initialize(table_width: nil, has_column_header: false, has_row_header: false, table_rows: nil, json: nil, id: nil,
14
+ parent: nil)
15
+ super json: json, id: id, parent: parent
16
+ if @json
17
+ sub_json = @json[type]
18
+ @has_column_header = sub_json["has_column_header"]
19
+ @has_row_header = sub_json["has_row_header"]
20
+ @table_width = sub_json["table_width"]
21
+ else
22
+ @table_width = table_width
23
+ @has_column_header = has_column_header
24
+ @has_row_header = has_row_header
25
+ if table_rows
26
+ @table_rows = table_rows.map do |table_row|
27
+ TableRowBlock.new table_row, @table_width
28
+ end
29
+ end
30
+ end
31
+ @can_have_children = true
32
+ end
33
+
34
+ def block_json(not_update: true)
35
+ ans = super
36
+ ans[type] = {
37
+ "has_column_header" => @has_column_header,
38
+ "has_row_header" => @has_row_header,
39
+ "table_width" => @table_width,
40
+ }
41
+ ans[type]["children"] = @table_rows.map(&:block_json) if @table_rows
42
+ ans
43
+ end
44
+
45
+ # @return [String (frozen)]
46
+ def type
47
+ "table"
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ # @param [String] color
6
+ class TableOfContentsBlock < Block
7
+ def initialize(color = "default", json: nil, id: nil, parent: nil)
8
+ super(json: json, id: id, parent: parent)
9
+ if @json
10
+ decode_color
11
+ else
12
+ @color = color
13
+ end
14
+ end
15
+
16
+ def color=(new_color)
17
+ @color = new_color
18
+ @payload.add_update_block_key "color"
19
+ end
20
+
21
+ # @return [String (frozen)]
22
+ def type
23
+ "table_of_contents"
24
+ end
25
+
26
+ # @param [Boolean] not_update false when update
27
+ # @return [Hash{String (frozen)->Hash}]
28
+ def block_json(not_update: true)
29
+ ans = super
30
+ ans[type] = {"color" => @color}
31
+ ans
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class TableRowBlock < Block
6
+ # @param [Array<Array<String, TextObject>>] array_array_of_text_objects
7
+ # @param [Integer] table_width
8
+ def initialize(array_array_of_text_objects = [], table_width = 3, json: nil, id: nil, parent: nil)
9
+ super json: json, id: id, parent: parent
10
+ if @json
11
+ @cells = @json[type]["cells"].map { |cell| cell.map { |to| RichTextObject.create_from_json to } }
12
+ else
13
+ cc = array_array_of_text_objects.count
14
+ raise StandardError, "table width must be #{table_width} (given array size is #{cc}" unless table_width == cc
15
+
16
+ @cells = array_array_of_text_objects.map do |cell|
17
+ Array(cell).map { |text_info| TextObject.text_object text_info }
18
+ end
19
+ end
20
+ @can_have_children = false
21
+ end
22
+
23
+ def block_json(not_update: true)
24
+ ans = super
25
+ ans[type] = {"cells" => @cells.map { |cell| Array(cell).map(&:property_values_json) }}
26
+ ans
27
+ end
28
+
29
+ # @return [String (frozen)]
30
+ def type
31
+ "table_row"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class TemplateBlock < Block
6
+ # @param [RichTextArray, String, Array<String>, RichTextObject, Array<RichTextObject>] text_info
7
+ # @param [NotionRubyMapping::Block, Array<NotionRubyMapping::Block>, nil] sub_blocks
8
+ def initialize(text_info = nil, sub_blocks: nil, json: nil, id: nil, parent: nil)
9
+ super(json: json, id: id, parent: parent)
10
+ if @json
11
+ decode_block_rich_text_array
12
+ else
13
+ rich_text_array_and_color "rich_text", text_info, nil
14
+ add_sub_blocks sub_blocks
15
+ end
16
+ @can_have_children = true
17
+ end
18
+
19
+ attr_reader :rich_text_array
20
+
21
+ # @param [Boolean] not_update false when update
22
+ # @return [Hash{String (frozen)->Hash}]
23
+ def block_json(not_update: true)
24
+ ans = super
25
+ ans[type] = @rich_text_array.update_property_schema_json not_update
26
+ ans[type]["children"] = @sub_blocks.map(&:block_json) if @sub_blocks
27
+ ans
28
+ end
29
+
30
+ def type
31
+ "template"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class TextSubBlockColorBaseBlock < Block
6
+ # @param [RichTextArray, String, Array<String>, RichTextObject, Array<RichTextObject>, nil] text_info
7
+ # @param [String] color
8
+ # @param [NotionRubyMapping::Block, Array<NotionRubyMapping::Block>, nil] sub_blocks
9
+ def initialize(text_info = nil, sub_blocks: nil, color: "default", json: nil, id: nil, parent: nil)
10
+ raise StandardError, "TextSubBlockColorBaseBlock is abstract class" if instance_of?(TextSubBlockColorBaseBlock)
11
+
12
+ super(json: json, id: id, parent: parent)
13
+ if @json
14
+ decode_block_rich_text_array
15
+ decode_color
16
+ else
17
+ rich_text_array_and_color "rich_text", text_info, color
18
+ add_sub_blocks sub_blocks
19
+ end
20
+ @can_have_children = true
21
+ end
22
+
23
+ # @see https://www.notion.so/hkob/BulletedListItemBlock-ac4978f4efbb40109f0fb3bd00f43476#36d044b3db734fc5b0e21c07d829cb81
24
+ # @see https://www.notion.so/hkob/BulletedListItemBlock-ac4978f4efbb40109f0fb3bd00f43476#cef80016457e46e7bb178f063e4981de
25
+ attr_reader :color, :rich_text_array
26
+
27
+ # @param [String] new_color
28
+ # @see https://www.notion.so/hkob/BulletedListItemBlock-ac4978f4efbb40109f0fb3bd00f43476#2d59111c9e434dfa99d294cc9a74e468
29
+ def color=(new_color)
30
+ @color = new_color
31
+ @payload.add_update_block_key "color"
32
+ @rich_text_array.will_update = true
33
+ end
34
+
35
+ # @param [Boolean] not_update false when update
36
+ # @return [Hash{String (frozen)->Hash}]
37
+ def block_json(not_update: true)
38
+ ans = super
39
+ ans[type] = @rich_text_array.update_property_schema_json not_update
40
+ ans[type]["color"] = @color
41
+ ans[type]["children"] = @sub_blocks.map(&:block_json) if @sub_blocks
42
+ ans
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class ToDoBlock < TextSubBlockColorBaseBlock
6
+ # @param [RichTextArray, String, Array<String>, RichTextObject, Array<RichTextObject>] text_info
7
+ # @param [Boolean] checked
8
+ # @param [NotionRubyMapping::Block, Array<NotionRubyMapping::Block>, nil] sub_blocks
9
+ # @param [String] color
10
+ def initialize(text_info = nil, checked = false, sub_blocks: nil, color: "default", json: nil, id: nil, parent: nil)
11
+ super(text_info, sub_blocks: sub_blocks, color: color, json: json, id: id, parent: parent)
12
+ @checked = if @json
13
+ @json[type]["checked"]
14
+ else
15
+ checked
16
+ end
17
+ end
18
+
19
+ # @see https://www.notion.so/hkob/ToDoBlock-9e4d863244b541869d91c84620e190d4#a4550dc684de43d2be171d4abbbea7ce
20
+ attr_reader :checked
21
+
22
+ # @param [Boolean] not_update false when update
23
+ # @return [Hash{String (frozen)->Hash}]
24
+ def block_json(not_update: true)
25
+ ans = super
26
+ ans[type]["checked"] = @checked
27
+ ans
28
+ end
29
+
30
+ # @param [Boolean] new_checked
31
+ # @see https://www.notion.so/hkob/ToDoBlock-9e4d863244b541869d91c84620e190d4#8ef8b12721914cccb17790879bdc2fbf
32
+ def checked=(new_checked)
33
+ @checked = new_checked
34
+ @payload.add_update_block_key "checked"
35
+ end
36
+
37
+ # @return [String (frozen)]
38
+ def type
39
+ "to_do"
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class ToggleBlock < TextSubBlockColorBaseBlock
6
+ # @return [String (frozen)]
7
+ def type
8
+ "toggle"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class ToggleHeading1Block < TextSubBlockColorBaseBlock
6
+ # @return [String (frozen)]
7
+ def type
8
+ "heading_1"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class ToggleHeading2Block < TextSubBlockColorBaseBlock
6
+ # @return [String (frozen)]
7
+ def type
8
+ "heading_2"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class ToggleHeading3Block < TextSubBlockColorBaseBlock
6
+ # @return [String (frozen)]
7
+ def type
8
+ "heading_3"
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class UrlBaseBlock < Block
6
+ # @param [Sting] url
7
+ def initialize(url, json: nil, id: nil, parent: nil)
8
+ raise StandardError, "UrlBaseBlock is abstract class" if instance_of?(UrlBaseBlock)
9
+
10
+ super(json: json, id: id, parent: parent)
11
+ @url = if @json
12
+ @json[type]["url"]
13
+ else
14
+ url
15
+ end
16
+ end
17
+
18
+ attr_reader :url
19
+
20
+ # @param [Boolean] not_update false when update
21
+ # @return [Hash{String (frozen)->Hash}]
22
+ def block_json(not_update: true)
23
+ ans = super
24
+ ans[type] = {"url" => @url}
25
+ ans
26
+ end
27
+
28
+ # @param [String] str
29
+ def url=(str)
30
+ @url = str
31
+ @payload.add_update_block_key "url"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class UrlCaptionBaseBlock < Block
6
+ # @param [Sting] url
7
+ # @param [RichTextArray, String, Array<String>, RichTextObject, Array<RichTextObject>] caption
8
+ # @see https://www.notion.so/hkob/BookmarkBlock-f2a8c15ad469436c966f74b58dcacbd4#845a1349bf5a4392b427199d6f327557
9
+ # @see https://www.notion.so/hkob/EmbedBlock-57c31e7d8e1d41669eb30f27e1c41035#3421ddd6f27f4ebea4c7e4450f81b866
10
+ def initialize(url = nil, caption: [], json: nil, id: nil, parent: nil)
11
+ raise StandardError, "UrlCaptionBaseBlock is abstract class" if instance_of?(UrlCaptionBaseBlock)
12
+
13
+ super(json: json, id: id, parent: parent)
14
+ if @json
15
+ @url = @json[type]["url"]
16
+ decode_block_caption
17
+ else
18
+ @url = url
19
+ @caption = RichTextArray.rich_text_array "caption", caption
20
+ end
21
+ end
22
+
23
+ # @see https://www.notion.so/hkob/BookmarkBlock-f2a8c15ad469436c966f74b58dcacbd4#bb6ff9f5dbdc4d52bbf8cdea89fc66de
24
+ # @see https://www.notion.so/hkob/BookmarkBlock-f2a8c15ad469436c966f74b58dcacbd4#eabb5436af464f77865e4a223da72329
25
+ # @see https://www.notion.so/hkob/EmbedBlock-57c31e7d8e1d41669eb30f27e1c41035#f28b77ca0b634acc8e606f954c516ae9
26
+ # @see https://www.notion.so/hkob/EmbedBlock-57c31e7d8e1d41669eb30f27e1c41035#3df6808f8eed43c7bc07ced53cbce6ba
27
+ attr_reader :caption, :url
28
+
29
+ # @param [Boolean] not_update false when update
30
+ # @return [Hash{String (frozen)->Hash}]
31
+ def block_json(not_update: true)
32
+ ans = super
33
+ ans[type] = @caption.update_property_schema_json not_update
34
+ ans[type]["url"] = @url
35
+ ans
36
+ end
37
+
38
+ # @param [String] str
39
+ # @see https://www.notion.so/hkob/BookmarkBlock-f2a8c15ad469436c966f74b58dcacbd4#054829bf342f40aea4fa6bd23820fbcb
40
+ # @see https://www.notion.so/hkob/EmbedBlock-57c31e7d8e1d41669eb30f27e1c41035#25ece6bfce0749f8b4bbecc6ba7feedc
41
+ def url=(str)
42
+ @url = str
43
+ @payload.add_update_block_key "url"
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NotionRubyMapping
4
+ # Notion block
5
+ class VideoBlock < FileBaseBlock
6
+ # @return [String (frozen)]
7
+ def type
8
+ "video"
9
+ end
10
+ end
11
+ end