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