๐ŸŽ›๏ธ

NotionCache

1. Singleton methods

self.instance โ†’ NotionCache

NotionCache class is a singleton class. NotionCache.instance creates a NotionCache object or retrieve an existing Notion Cache object.
NotionCache.instance # => #<NotionRubyMapping::NotionCache:...> # created or existing NotionCache object

2. Instance methods

create_client(notion_token, wait: 0.1)

  • [PARAM] notion_token Notion integration token
  • [PARAM(optional)] wait sleep time before calling API. Notion API has a limit for 3 accesses per second. In this tool, the default wait is 0.3333 seconds.
Please create a client (notion-ruby-client) before you use the following class.
NotionCache.instance.create_client "secret_XXXXXXXXXXXXXXXXXXXX" # write directly NotionCache.instance.create_client ENV["NOTION_API_TOKEN"], wait: 0.1 # token from environment and short wait

hex_id(id)

  • [PARAM] id XXX_id with โ€œ-โ€
hex_id returns XXX_id without โ€œ-โ€
NotionCache.instance.hex_id "0a58761e-f3b4-429f-b86e-0ad9ff815fe1" # => "0a58761ef3b4429fb86e0ad9ff815fe1"