Releases: mgmarlow/notion-sdk-ruby
v0.6.1
v0.6.0
What's Changed
- Documentation has moved! Check it out here: https://mgmarlow.github.io/notion-sdk-ruby/
- Updated to latest Notion client
Breaking changes
- The default client version is Notion's latest
"2022-02-22"
- Removed
client.databases.list
(see Notion's deprecation notice)
Upcoming
- New endpoints:
Blocks#delete
andPages#properties#retrieve
- More helpful pagination APIs
- Examples
Full Changelog: v0.5.0...v0.6.0
v0.5.0
v0.5.0
is a big update that introduces some much-needed changes.
New features & breaking changes
All SDK methods now return proper Ruby objects (for now, just simple OpenStruct
wrappers). You no longer need to deal with HTTP responses yourself when using the SDK (whew!).
Here are the new models:
Notion::User
Notion::Database
Notion::Page
Notion::Block
Notion::List
Example use:
client = Notion::Client.new(token: "secret_token")
users = client.users.list
=> <Notion::List @data=[...]>
users.data
=> [<Notion::User object="user" id="...">, ...]
puts users.data.first.name
=> "Luke Skywalker"
my_page = client.pages.retrieve("page-id")
my_page.properties
=> {"title"=>
{"id"=>"title",
"type"=>"title",
"title"=>
[{"type"=>"text",
"text"=>{"content"=>"test", "link"=>nil},
"annotations"=>
{"bold"=>false, "italic"=>false, "strikethrough"=>false, "underline"=>false, "code"=>false, "color"=>"default"},
"plain_text"=>"test",
"href"=>nil}]}}
Other updates
- Switched from httparty to faraday for HTTP handling
- Greatly increased test coverage and improved quality of fixture-based testing
v0.4.1
0.4.0
You can now create databases! Check out the official release post: https://developers.notion.com/changelog/create-new-databases-with-post-databases
v0.3.1
Changelog
- Add the
Notion-Version
header to requests. More details: https://developers.notion.com/reference/versioning.
Thanks
Thanks to @cjavilla-stripe for fixing this issue!
v0.3.0
Lots of adjustments in this new release. The goal is to bridge some of the delta between this SDK and the official JS SDK.
1. Error handling overhaul
When 4xx/5xx errors occur, they no longer return JSON responses to the client method. Instead, they raise an appropriate Notion
error.
Example using the new error classes:
def list_users
client.users.retrieve("invalid-id")
rescue Notion::APIResponseError => e
puts e.code
# "object_not_found"
end
2. Namespace updates to match notion-sdk-js
All Notion::Client
methods have been updated to match the JS SDK counterpart and align better with the official Notion API documentation. For example,
client.get_users
is now
client.users.list
and so on for all other methods in the SDK. The only method that wasn't changed was client#search
, since that already matched the Notion API.