Module: Utils::Notion::Types

Defined in:
lib/bas/utils/notion/types.rb

Overview

This module is a Notion utility for formating standard notion types to filter or create.

Instance Method Summary collapse

Instance Method Details

#relation(id) ⇒ Object



10
11
12
# File 'lib/bas/utils/notion/types.rb', line 10

def relation(id)
  { relation: [{ id: }] }
end

#rich_text(content, url = nil) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/bas/utils/notion/types.rb', line 18

def rich_text(content, url = nil)
  text = { content: }

  text = text.merge({ link: { url: } }) unless url.nil?

  { rich_text: [{ text: }] }
end

#select(name) ⇒ Object



14
15
16
# File 'lib/bas/utils/notion/types.rb', line 14

def select(name)
  { select: { name: } }
end

#status(name) ⇒ Object



26
27
28
# File 'lib/bas/utils/notion/types.rb', line 26

def status(name)
  { status: { name: } }
end

#title(content) ⇒ Object



30
31
32
# File 'lib/bas/utils/notion/types.rb', line 30

def title(content)
  { title: [{ text: { content: } }] }
end