notion-sdk-ruby 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 646301fd9a326d4b9d74cb514b948f85ff38dc0c7f001edd5c94285510029088
4
- data.tar.gz: a544ddbd17c26ba618082eb04dc2e3e268da12b1b9d729fbf9109c8d642fc803
3
+ metadata.gz: 006e8ac9f857ad0644041bd3ba45608730e72095c021e19034254ed0d75372ad
4
+ data.tar.gz: 8ba2f237a80ca3aebb2532d52f3d5ffa58337181278062dd0f31c01d66d8a5a5
5
5
  SHA512:
6
- metadata.gz: 256824b18cfead3ab2630a96906022a5d8e936c3323824c5dd72e6605592c67fc2fa94d59f71796365e3639ced885b7f3344f6f39300fa7b74211be1ee618506
7
- data.tar.gz: e7ec55aea773b32cead4f0ce0a788435abdd7e45f7a7050f9541a0c3514d612786f4be6661fa1fb35ddc904ca8961d363120d02a57035e14683f3c6d7c20eb80
6
+ metadata.gz: e2bf9572dd3947686b40b734a642b782fd0ef0efb94f6714b66d7d4815e9625453febb5ae1f5c44588289266c1ca43fa7c24c15aba9bd0bc12f6bceebff1334d
7
+ data.tar.gz: 2d850b377b632e59c533fcdac1a52b1989f72c7fd64c340332b9c0a7cb752b5e7fb4459b30b43a1b4047dd948b1a86d58cbb7ff5774a734dfdf872df081eb2d8
@@ -0,0 +1,34 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: ci
9
+
10
+ on:
11
+ push:
12
+ branches: [main]
13
+ pull_request:
14
+ branches: [main]
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ ruby-version: ["2.6", "2.7", "3.0"]
22
+
23
+ steps:
24
+ - uses: actions/checkout@v2
25
+ - name: Set up Ruby
26
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
27
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
28
+ # uses: ruby/setup-ruby@v1
29
+ uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
30
+ with:
31
+ ruby-version: ${{ matrix.ruby-version }}
32
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
33
+ - name: Run tests
34
+ run: bundle exec rake
data/.gitignore CHANGED
@@ -1,13 +1,13 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
12
-
13
- .env
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+
13
+ .env
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.5
6
- before_install: gem install bundler -v 2.1.4
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.5
6
+ before_install: gem install bundler -v 2.1.4
@@ -1,4 +1,4 @@
1
- {
2
- "editor.formatOnSave": true,
3
- "editor.tabSize": 2
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.tabSize": 2
4
4
  }
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notion-sdk-ruby (0.3.0)
4
+ notion-sdk-ruby (0.3.1)
5
5
  httparty (~> 0.18.1)
6
6
 
7
7
  GEM
data/LICENSE.txt CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2021 Graham Marlow
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Graham Marlow
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,7 +1,34 @@
1
1
  # Notion Ruby SDK
2
2
 
3
+ [![ci](https://github.com/mgmarlow/notion-sdk-ruby/actions/workflows/ci.yml/badge.svg)](https://github.com/mgmarlow/notion-sdk-ruby/actions/workflows/ci.yml)
4
+ [![Gem Version](https://badge.fury.io/rb/notion-sdk-ruby.svg)](https://badge.fury.io/rb/notion-sdk-ruby)
5
+
3
6
  Unofficial Ruby client for the [Notion APIs](https://developers.notion.com/).
4
7
 
8
+ - [Notion Ruby SDK](#notion-ruby-sdk)
9
+ - [Installation](#installation)
10
+ - [Usage](#usage)
11
+ - [API reference](#api-reference)
12
+ - [Databases](#databases)
13
+ - [databases#retrieve](#databasesretrieve)
14
+ - [databases#list](#databaseslist)
15
+ - [databases#query](#databasesquery)
16
+ - [Pages](#pages)
17
+ - [pages#retrieve](#pagesretrieve)
18
+ - [pages#create](#pagescreate)
19
+ - [pages#update](#pagesupdate)
20
+ - [Blocks](#blocks)
21
+ - [blocks#children#list](#blockschildrenlist)
22
+ - [blocks#children#append](#blockschildrenappend)
23
+ - [Users](#users)
24
+ - [users#retrieve](#usersretrieve)
25
+ - [users#list](#userslist)
26
+ - [Search](#search)
27
+ - [#search](#search-1)
28
+ - [Development](#development)
29
+ - [Contributing](#contributing)
30
+ - [License](#license)
31
+
5
32
  ## Installation
6
33
 
7
34
  Add this line to your application's Gemfile:
@@ -217,6 +244,14 @@ client.search({
217
244
 
218
245
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
219
246
 
247
+ Before using `bin/console` you need to create a new file, `.env`, at the root project directory. This will enable you to run commands directly against your [Notion integration](https://developers.notion.com/docs/getting-started).
248
+
249
+ ```
250
+ cat > .env <<EOF
251
+ API_SECRET=<YOUR NOTION API SECRET HERE>
252
+ EOF
253
+ ```
254
+
220
255
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
221
256
 
222
257
  ## Contributing
data/bin/console CHANGED
@@ -7,6 +7,5 @@ require 'dotenv/load'
7
7
  require "notion-sdk-ruby"
8
8
 
9
9
  $client = Notion::Client.new(token: ENV["API_SECRET"])
10
- $client2 = Notion::Client.new(token: ENV["API_SECRET"])
11
10
 
12
11
  Pry.start
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -22,5 +22,6 @@ module Notion
22
22
  attr_reader :config
23
23
 
24
24
  def_delegators :@config, :api_token, :api_token=
25
+ def_delegators :@config, :notion_version, :notion_version=
25
26
  end
26
27
  end
@@ -2,8 +2,9 @@ module Notion
2
2
  class Client
3
3
  include Operations::Search
4
4
 
5
- def initialize(token:)
5
+ def initialize(token:, notion_version: "2021-05-13")
6
6
  Notion.api_token = token
7
+ Notion.notion_version = notion_version
7
8
  end
8
9
 
9
10
  def blocks
@@ -1,5 +1,5 @@
1
1
  module Notion
2
2
  class Config
3
- attr_accessor :api_token
3
+ attr_accessor :api_token, :notion_version
4
4
  end
5
5
  end
@@ -11,6 +11,7 @@ module Notion
11
11
 
12
12
  def initialize(config)
13
13
  self.class.headers Authorization: "Bearer #{config.api_token}"
14
+ self.class.headers "Notion-Version": config.notion_version
14
15
  end
15
16
 
16
17
  def get(*args, &block)
@@ -1,3 +1,3 @@
1
1
  module Notion
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notion-sdk-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Graham Marlow
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-05-23 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -115,7 +115,7 @@ executables: []
115
115
  extensions: []
116
116
  extra_rdoc_files: []
117
117
  files:
118
- - ".github/workflows/ruby.yml"
118
+ - ".github/workflows/ci.yml"
119
119
  - ".gitignore"
120
120
  - ".rspec"
121
121
  - ".travis.yml"
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  - !ruby/object:Gem::Version
162
162
  version: '0'
163
163
  requirements: []
164
- rubygems_version: 3.0.3
164
+ rubygems_version: 3.1.2
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: Notion SDK
@@ -1,35 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: Ruby
9
-
10
- on:
11
- push:
12
- branches: [ main ]
13
- pull_request:
14
- branches: [ main ]
15
-
16
- jobs:
17
- test:
18
-
19
- runs-on: ubuntu-latest
20
- strategy:
21
- matrix:
22
- ruby-version: ['2.6', '2.7', '3.0']
23
-
24
- steps:
25
- - uses: actions/checkout@v2
26
- - name: Set up Ruby
27
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
- # uses: ruby/setup-ruby@v1
30
- uses: ruby/setup-ruby@473e4d8fe5dd94ee328fdfca9f8c9c7afc9dae5e
31
- with:
32
- ruby-version: ${{ matrix.ruby-version }}
33
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
34
- - name: Run tests
35
- run: bundle exec rake