Skip to content

Instantly share code, notes, and snippets.

@fsubal
Last active June 6, 2024 18:22
Show Gist options
  • Save fsubal/12d0e7207a0076ba2636e67551c72dac to your computer and use it in GitHub Desktop.
Save fsubal/12d0e7207a0076ba2636e67551c72dac to your computer and use it in GitHub Desktop.
Notion ActiveRecord
module Notion
class Task < Database::Page
self.database_id = 'e383bcee-e0d8-4564-9c63-900d307abdb0'
def event_date
property('作成日時') #=> Notion::Database::Property
end
def assignees
property('担当者') #=> Array<Notion::Database::Property>
end
def status
property('ステータス') #=> Notion::Database::Property
end
def projects
property('関連するプロジェクト') #=> Array<Notion::Database::Page>
end
end
end
task = Notion::Task.find_by_page_id!('...')
task.body.search('h2 + ul > li') #=> Notion::RichText::Node
task.comments #=> Array<Notion::Database::Comment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment