Module: Ask::Notion
- Defined in:
- lib/ask/notion/client.rb,
lib/ask/notion/context.rb,
lib/ask/notion/version.rb,
lib/ask/notion/error_guide.rb
Defined Under Namespace
Modules: Errors Classes: ClientProxy
Constant Summary collapse
- DEFAULT_RETRIES =
Default number of retries for transient failures.
3- DESCRIPTION =
Human-readable description of the Notion service context.
"Notion — pages, databases, blocks, comments, users, search"- DOCS_URL =
Base URL for Notion API documentation.
"https://developers.notion.com/"- API_REF_URL =
URL for the Notion API reference.
"https://developers.notion.com/reference"- OPENAPI_URL =
URL for the Notion OpenAPI specification.
"https://developers.notion.com/.well-known/openapi.json"- AUTH_NAME =
Credential name used with Ask::Auth.resolve.
:notion_token- AUTH_HOW =
Instructions for obtaining a Notion Internal Integration Token.
"https://www.notion.so/my-integrations — create an integration and copy the 'Internal Integration Secret' (starts with 'ntn_' or 'secret_')"- GEM_NAME =
Gem name for the Notion API client.
"notion-ruby-client"- GEM_VERSION =
Required gem version constraint.
"~> 1.2"- GEM_DOCS =
URL for notion-ruby-client library documentation.
"https://www.rubydoc.info/gems/notion-ruby-client"- QUICK_START =
Quick-start Ruby code snippet for agents to copy-paste.
<<~RUBY client = Ask::Notion.client client.database_query(database_id: "DB_ID") client.page_retrieve(page_id: "PAGE_ID") client.page_create(parent: { database_id: "DB_ID" }, properties: { "Name": { title: [{ text: { content: "New Page" } }] } }) client.page_update(page_id: "PAGE_ID", properties: { "Status": { status: { name: "Done" } } }) client.block_children_list(block_id: "BLOCK_ID") client.append_block_children(block_id: "BLOCK_ID", children: [{ paragraph: { rich_text: [{ text: { content: "Hello!" } }] } }]) client.search(query: "project") RUBY
- VERSION =
'0.1.1'
Class Method Summary collapse
-
.client ⇒ ::Notion::Client
Returns an authenticated Notion API client configured for an AI agent.
Class Method Details
.client ⇒ ::Notion::Client
Returns an authenticated Notion API client configured for an AI agent.
Resolves the Notion token via Ask::Auth.resolve(:notion_token) and wraps the client in a proxy that converts authentication, timeout, and network errors into ask-rb equivalents.
The client inherits default configuration from Notion::Config:
-
token: resolved via Ask::Auth -
logger: default logger
Retries transient failures (rate limits, server errors) up to DEFAULT_RETRIES times with exponential backoff.
31 32 33 34 35 |
# File 'lib/ask/notion/client.rb', line 31 def self.client token = Ask::Auth.resolve(:notion_token) ClientProxy.new(::Notion::Client.new(token: token)) end |