Module: Woods::Notion::Mappers::Shared
- Included in:
- ColumnMapper, ModelMapper
- Defined in:
- lib/woods/notion/mappers/shared.rb
Overview
Shared helpers for Notion mapper classes.
Constant Summary collapse
- MAX_RICH_TEXT_LENGTH =
2000
Instance Method Summary collapse
-
#rich_text_property(text) ⇒ Hash
Build a Notion rich_text property, truncating to API limits.
Instance Method Details
#rich_text_property(text) ⇒ Hash
Build a Notion rich_text property, truncating to API limits.
14 15 16 17 18 |
# File 'lib/woods/notion/mappers/shared.rb', line 14 def rich_text_property(text) content = text.to_s content = "#{content[0...1997]}..." if content.length > MAX_RICH_TEXT_LENGTH { rich_text: [{ text: { content: content } }] } end |