notion_ruby_mapping 0.3.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +44 -1237
- data/env.yml.sample +0 -13
- data/examples/change_title.md +1 -1
- data/examples/renumbering_pages.md +3 -3
- data/examples/set_icon_to_all_icon_unsettled_pages.md +4 -4
- data/lib/notion_ruby_mapping/{base.rb → blocks/base.rb} +163 -92
- data/lib/notion_ruby_mapping/blocks/block.rb +145 -0
- data/lib/notion_ruby_mapping/blocks/bookmark_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/breadcrumb_block.rb +19 -0
- data/lib/notion_ruby_mapping/blocks/bulleted_list_item_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/callout_block.rb +82 -0
- data/lib/notion_ruby_mapping/blocks/child_base_block.rb +21 -0
- data/lib/notion_ruby_mapping/blocks/child_database_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/child_page_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/code_block.rb +50 -0
- data/lib/notion_ruby_mapping/blocks/column_block.rb +29 -0
- data/lib/notion_ruby_mapping/blocks/column_list_block.rb +33 -0
- data/lib/notion_ruby_mapping/{database.rb → blocks/database.rb} +41 -8
- data/lib/notion_ruby_mapping/blocks/divider_block.rb +19 -0
- data/lib/notion_ruby_mapping/blocks/embed_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/equation_block.rb +43 -0
- data/lib/notion_ruby_mapping/blocks/file_base_block.rb +50 -0
- data/lib/notion_ruby_mapping/blocks/file_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/heading1_block.rb +18 -0
- data/lib/notion_ruby_mapping/blocks/heading2_block.rb +18 -0
- data/lib/notion_ruby_mapping/blocks/heading3_block.rb +18 -0
- data/lib/notion_ruby_mapping/blocks/image_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/link_preview_block.rb +16 -0
- data/lib/notion_ruby_mapping/blocks/link_to_page_block.rb +40 -0
- data/lib/notion_ruby_mapping/{list.rb → blocks/list.rb} +37 -6
- data/lib/notion_ruby_mapping/blocks/numbered_list_item_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/page.rb +77 -0
- data/lib/notion_ruby_mapping/blocks/paragraph_block.rb +11 -0
- data/lib/notion_ruby_mapping/{block.rb → blocks/pdf_block.rb} +4 -3
- data/lib/notion_ruby_mapping/blocks/quote_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/synced_block.rb +44 -0
- data/lib/notion_ruby_mapping/blocks/table_block.rb +50 -0
- data/lib/notion_ruby_mapping/blocks/table_of_contents_block.rb +34 -0
- data/lib/notion_ruby_mapping/blocks/table_row_block.rb +34 -0
- data/lib/notion_ruby_mapping/blocks/template_block.rb +34 -0
- data/lib/notion_ruby_mapping/blocks/text_sub_block_color_base_block.rb +45 -0
- data/lib/notion_ruby_mapping/blocks/to_do_block.rb +42 -0
- data/lib/notion_ruby_mapping/blocks/toggle_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/toggle_heading1_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/toggle_heading2_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/toggle_heading3_block.rb +11 -0
- data/lib/notion_ruby_mapping/blocks/url_base_block.rb +34 -0
- data/lib/notion_ruby_mapping/blocks/url_caption_base_block.rb +46 -0
- data/lib/notion_ruby_mapping/blocks/video_block.rb +11 -0
- data/lib/notion_ruby_mapping/{notion_cache.rb → controllers/notion_cache.rb} +144 -102
- data/lib/notion_ruby_mapping/{payload.rb → controllers/payload.rb} +32 -18
- data/lib/notion_ruby_mapping/{property_cache.rb → controllers/property_cache.rb} +21 -20
- data/lib/notion_ruby_mapping/{query.rb → controllers/query.rb} +27 -19
- data/lib/notion_ruby_mapping/{rich_text_array.rb → controllers/rich_text_array.rb} +39 -17
- data/lib/notion_ruby_mapping/objects/emoji_object.rb +40 -0
- data/lib/notion_ruby_mapping/objects/equation_object.rb +43 -0
- data/lib/notion_ruby_mapping/objects/file_object.rb +60 -0
- data/lib/notion_ruby_mapping/{mention_object.rb → objects/mention_object.rb} +11 -0
- data/lib/notion_ruby_mapping/{rich_text_object.rb → objects/rich_text_object.rb} +12 -4
- data/lib/notion_ruby_mapping/{text_object.rb → objects/text_object.rb} +0 -1
- data/lib/notion_ruby_mapping/{user_object.rb → objects/user_object.rb} +9 -4
- data/lib/notion_ruby_mapping/{checkbox_property.rb → properties/checkbox_property.rb} +3 -0
- data/lib/notion_ruby_mapping/{created_by_property.rb → properties/created_by_property.rb} +1 -0
- data/lib/notion_ruby_mapping/{created_time_property.rb → properties/created_time_property.rb} +1 -0
- data/lib/notion_ruby_mapping/properties/date_base_property.rb +135 -0
- data/lib/notion_ruby_mapping/{date_property.rb → properties/date_property.rb} +13 -0
- data/lib/notion_ruby_mapping/{email_property.rb → properties/email_property.rb} +2 -2
- data/lib/notion_ruby_mapping/{files_property.rb → properties/files_property.rb} +26 -13
- data/lib/notion_ruby_mapping/{formula_property.rb → properties/formula_property.rb} +5 -1
- data/lib/notion_ruby_mapping/{last_edited_by_property.rb → properties/last_edited_by_property.rb} +1 -0
- data/lib/notion_ruby_mapping/{last_edited_time_property.rb → properties/last_edited_time_property.rb} +1 -0
- data/lib/notion_ruby_mapping/{multi_property.rb → properties/multi_property.rb} +0 -0
- data/lib/notion_ruby_mapping/{multi_select_property.rb → properties/multi_select_property.rb} +4 -3
- data/lib/notion_ruby_mapping/{number_property.rb → properties/number_property.rb} +4 -0
- data/lib/notion_ruby_mapping/{people_property.rb → properties/people_property.rb} +8 -3
- data/lib/notion_ruby_mapping/{phone_number_property.rb → properties/phone_number_property.rb} +4 -1
- data/lib/notion_ruby_mapping/{property.rb → properties/property.rb} +33 -0
- data/lib/notion_ruby_mapping/{relation_property.rb → properties/relation_property.rb} +30 -10
- data/lib/notion_ruby_mapping/{rich_text_property.rb → properties/rich_text_property.rb} +0 -0
- data/lib/notion_ruby_mapping/{rollup_property.rb → properties/rollup_property.rb} +7 -0
- data/lib/notion_ruby_mapping/{select_property.rb → properties/select_property.rb} +8 -2
- data/lib/notion_ruby_mapping/{text_property.rb → properties/text_property.rb} +0 -0
- data/lib/notion_ruby_mapping/{title_property.rb → properties/title_property.rb} +0 -0
- data/lib/notion_ruby_mapping/{url_property.rb → properties/url_property.rb} +4 -1
- data/lib/notion_ruby_mapping/version.rb +1 -1
- data/lib/notion_ruby_mapping.rb +21 -7
- metadata +82 -40
- data/lib/notion_ruby_mapping/date_base_property.rb +0 -75
- data/lib/notion_ruby_mapping/page.rb +0 -50
@@ -1,50 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module NotionRubyMapping
|
4
|
-
# Notion page object
|
5
|
-
class Page < Base
|
6
|
-
### Public announced methods
|
7
|
-
|
8
|
-
# @param [String] id
|
9
|
-
# @return [NotionRubyMapping::Page, String]
|
10
|
-
def self.find(id, dry_run: false)
|
11
|
-
nc = NotionCache.instance
|
12
|
-
if dry_run
|
13
|
-
Base.dry_run_script :get, nc.page_path(id)
|
14
|
-
else
|
15
|
-
nc.page id
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def create_child_database(title, *assign)
|
20
|
-
Database.new json: {"title" => [TextObject.new(title).property_values_json]},
|
21
|
-
assign: assign, parent: {"type" => "page_id", "page_id" => @id}
|
22
|
-
end
|
23
|
-
|
24
|
-
protected
|
25
|
-
|
26
|
-
# @return [NotionRubyMapping::Base, String]
|
27
|
-
def create(dry_run: false)
|
28
|
-
if dry_run
|
29
|
-
dry_run_script :post, @nc.pages_path, :property_values_json
|
30
|
-
else
|
31
|
-
@new_record = false
|
32
|
-
update_json @nc.create_page_request(property_values_json)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [Hash]
|
37
|
-
def reload_json
|
38
|
-
@nc.page_request @id
|
39
|
-
end
|
40
|
-
|
41
|
-
# @return [NotionRubyMapping::Base, String]
|
42
|
-
def update(dry_run: false)
|
43
|
-
if dry_run
|
44
|
-
dry_run_script :patch, @nc.page_path(@id), :property_values_json
|
45
|
-
else
|
46
|
-
update_json @nc.update_page_request(@id, property_values_json)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|