<aside> 👉
Links (Block base class)
Notion Ruby Mapping Public API Reference
</aside>
$\fbox{implemented in UrlBaseBlock}$
LinkPreviewBlockself.new creates an in-memory LinkPreviewBlock object using url. A Link Preview has a URL but does not have a caption.
b = LinkPreviewBlock.new "<https://github.com/example/example-repo/pull/1234>"
b.block_json
# => {"type"=>"link_preview", "object"=>"block", "link_preview"=>{"url"=>"<https://github.com/example/example-repo/pull/1234>"}}
<aside> ⚠️
The Notion API can return link_preview blocks, but does not support creating or appending them. Use Block.find to retrieve an existing Link Preview when working with workspace content.
</aside>
$\fbox{implemented in Block}$
true returns a verification script without sending the request (Boolean)dry_run: truesave sends changes made to an existing LinkPreviewBlock through the Update a block API. Retrieve the existing block before updating it because the Notion API does not support creating or appending link_preview blocks.
block = Block.find "link_preview_block_id"
block.url = "<https://github.com/example/example-repo/pull/5678>"
block.save
# => #<NotionRubyMapping::LinkPreviewBlock:...>
With dry_run: true, save returns a verification script. The update payload uses the link_preview key.
block = Block.find "link_preview_block_id"
block.url = "<https://github.com/example/example-repo/pull/5678>"
block.save dry_run: true
# => curl -X PATCH '<https://api.notion.com/v1/blocks/link_preview_block_id>' ...
# --data '{"link_preview":{"url":"<https://github.com/example/example-repo/pull/5678>"}}'
$\fbox{implemented in UrlBaseBlock}$
url returns the URL stored in the LinkPreviewBlock.
b = LinkPreviewBlock.new "<https://github.com/example/example-repo/pull/1234>"
b.url
# => "<https://github.com/example/example-repo/pull/1234>"
$\fbox{implemented in UrlBaseBlock}$