Class: NotionRubyMapping::UrlCaptionBaseBlock
- Defined in:
- lib/notion_ruby_mapping/blocks/url_caption_base_block.rb
Overview
Notion block
Direct Known Subclasses
Instance Attribute Summary collapse
- #caption ⇒ Object readonly
- #url ⇒ Object
Attributes inherited from Block
#can_append, #can_have_children, #color, #language, #rich_text_array, #type
Attributes inherited from Base
#archived, #has_children, #id, #json
Instance Method Summary collapse
-
#block_json(not_update: true) ⇒ Hash{String (frozen)->Hash
].
-
#initialize(url = nil, caption: [], json: nil, id: nil, parent: nil) ⇒ UrlCaptionBaseBlock
constructor
A new instance of UrlCaptionBaseBlock.
Methods inherited from Block
#append_after, #children_block_json, decode_block, #decode_block_caption, #decode_block_rich_text_array, #decode_color, #destroy, find, type2class, #update, #update_block_json
Methods inherited from Base
#append_block_children, #assert_parent_children_pair, #assign_property, #block?, block_id, #children, #comments, #cover, create_from_json, #created_time, #database?, database_id, dry_run_script, #get, #icon, #inspect, #json_properties, #last_edited_time, #new_record?, #page?, page_id, #parent, #parent_id, #properties, #property_values_json, #reload, #restore_from_json, #save, #set_cover, #set_icon, #synced_block_original?, #update_json
Constructor Details
#initialize(url = nil, caption: [], json: nil, id: nil, parent: nil) ⇒ UrlCaptionBaseBlock
Returns a new instance of UrlCaptionBaseBlock.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/notion_ruby_mapping/blocks/url_caption_base_block.rb', line 10 def initialize(url = nil, caption: [], json: nil, id: nil, parent: nil) raise StandardError, "UrlCaptionBaseBlock is abstract class" if instance_of?(UrlCaptionBaseBlock) super(json: json, id: id, parent: parent) if @json @url = @json[type]["url"] decode_block_caption else @url = url @caption = RichTextArray.rich_text_array "caption", caption end end |
Instance Attribute Details
#caption ⇒ Object (readonly)
27 28 29 |
# File 'lib/notion_ruby_mapping/blocks/url_caption_base_block.rb', line 27 def caption @caption end |
#url ⇒ Object
27 28 29 |
# File 'lib/notion_ruby_mapping/blocks/url_caption_base_block.rb', line 27 def url @url end |
Instance Method Details
#block_json(not_update: true) ⇒ Hash{String (frozen)->Hash
Returns ].
31 32 33 34 35 36 |
# File 'lib/notion_ruby_mapping/blocks/url_caption_base_block.rb', line 31 def block_json(not_update: true) ans = super ans[type] = @caption.update_property_schema_json not_update ans[type]["url"] = @url ans end |