notion-ruby-client 0.0.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 +7 -0
- data/Gemfile +4 -0
- data/LICENSE.md +21 -0
- data/README.md +45 -0
- data/lib/notion-ruby-client.rb +28 -0
- data/lib/notion.rb +2 -0
- data/lib/notion/api/endpoints.rb +11 -0
- data/lib/notion/api/endpoints/users.rb +33 -0
- data/lib/notion/api/error.rb +6 -0
- data/lib/notion/api/errors.rb +19 -0
- data/lib/notion/api/errors/internal_error.rb +12 -0
- data/lib/notion/api/errors/notion_error.rb +15 -0
- data/lib/notion/client.rb +28 -0
- data/lib/notion/config.rb +50 -0
- data/lib/notion/faraday/connection.rb +37 -0
- data/lib/notion/faraday/request.rb +39 -0
- data/lib/notion/faraday/response/raise_error.rb +32 -0
- data/lib/notion/faraday/response/wrap_error.rb +22 -0
- data/lib/notion/logger.rb +14 -0
- data/lib/notion/messages/message.rb +17 -0
- data/lib/notion/pagination/cursor.rb +50 -0
- data/lib/notion/version.rb +4 -0
- data/lib/notion_ruby_client.rb +2 -0
- data/notion-ruby-client.gemspec +29 -0
- data/scratchpad.rb +22 -0
- data/screenshots/create_notion_bot.png +0 -0
- metadata +221 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c7b5900bd2cb236225f473631b1ee926827a33616a88640925ca18e6e185a3d1
|
4
|
+
data.tar.gz: 4305a9c2c648830f3e28a3e9cb5bc3e1ad71dec502ef3adc853d661dfcd0983b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 62c41933e6d555c26e366ac86ed551e0c4d903c57f9d69bd2904b8139bcebbcd614ce0fdcc79ae60e4107a8b3a7536e1ea568a39db159cd2badc15964fe2f841
|
7
|
+
data.tar.gz: aba7f94cce923825e99d6780ae99b5a5043ad48e599e4775fd6b1e1cdd35036777b0f2db8efd1f541b59a1fb659328351b5d71d98f566629d8efbefac0959a19
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 Orbit
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# Notion Ruby Client
|
2
|
+
|
3
|
+
A Ruby client for the Notion API.
|
4
|
+
|
5
|
+
## Table of Contents
|
6
|
+
|
7
|
+
- [Installation](#installation)
|
8
|
+
- [Usage](#usage)
|
9
|
+
- [Create a New Bot Integration](#create-a-new-bot-integration)
|
10
|
+
- [Declare the API Token](#declare-the-api-token)
|
11
|
+
- [API Client](#api-client)
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
Add to Gemfile.
|
16
|
+
|
17
|
+
```
|
18
|
+
gem 'notion-ruby-client'
|
19
|
+
```
|
20
|
+
|
21
|
+
Run `bundle install`.
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
### Create a New Bot Integration
|
26
|
+
|
27
|
+
To integrate your bot with Notion, you must first create a new Notion Bot. (**TODO**: link to the docs)
|
28
|
+
|
29
|
+
1. Log into the workspace that you want your integration to be associated with.
|
30
|
+
2. Confirm that you are an Admin in the workspace (see Settings & Members > Members).
|
31
|
+
3. Go to Settings & Members, and click API
|
32
|
+
|
33
|
+

|
34
|
+
|
35
|
+
### Declare the API token
|
36
|
+
|
37
|
+
```
|
38
|
+
Notion.configure do |config|
|
39
|
+
config.token = ENV['NOTION_API_TOKEN']
|
40
|
+
end
|
41
|
+
```
|
42
|
+
|
43
|
+
### API Client
|
44
|
+
|
45
|
+
TODO: document endpoints
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative 'notion/version'
|
3
|
+
require_relative 'notion/logger'
|
4
|
+
require_relative 'notion/config'
|
5
|
+
|
6
|
+
# Messages
|
7
|
+
require 'hashie'
|
8
|
+
require_relative 'notion/messages/message'
|
9
|
+
require_relative 'notion/messages/formatting'
|
10
|
+
|
11
|
+
# Web API
|
12
|
+
require 'faraday'
|
13
|
+
require 'faraday_middleware'
|
14
|
+
require 'json'
|
15
|
+
require 'logger'
|
16
|
+
|
17
|
+
require_relative 'notion/config'
|
18
|
+
require_relative 'notion/api/errors/notion_error'
|
19
|
+
require_relative 'notion/api/error'
|
20
|
+
require_relative 'notion/api/errors'
|
21
|
+
require_relative 'notion/api/errors/internal_error'
|
22
|
+
require_relative 'notion/faraday/response/raise_error'
|
23
|
+
require_relative 'notion/faraday/response/wrap_error'
|
24
|
+
require_relative 'notion/faraday/connection'
|
25
|
+
require_relative 'notion/faraday/request'
|
26
|
+
require_relative 'notion/api/endpoints'
|
27
|
+
require_relative 'notion/pagination/cursor'
|
28
|
+
require_relative 'notion/client'
|
data/lib/notion.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Notion
|
4
|
+
module Api
|
5
|
+
module Endpoints
|
6
|
+
module Users
|
7
|
+
#
|
8
|
+
# Retrieves a User object using the ID specified in the request.
|
9
|
+
#
|
10
|
+
# @option options [id] :id
|
11
|
+
# User to get info on.
|
12
|
+
def user(options = {})
|
13
|
+
throw ArgumentError.new('Required arguments :id missing') if options[:id].nil?
|
14
|
+
get("users/#{options[:id]}")
|
15
|
+
end
|
16
|
+
|
17
|
+
#
|
18
|
+
# Returns a paginated list of User objects for the workspace.
|
19
|
+
# @option options [Object] :start_cursor
|
20
|
+
# Paginate through collections of data by setting the cursor parameter to a start_cursor attribute returned by a previous request's next_cursor. Default value fetches the first "page" of the collection. See pagination for more detail.
|
21
|
+
def users_list(options = {})
|
22
|
+
if block_given?
|
23
|
+
Pagination::Cursor.new(self, :users_list, options).each do |page|
|
24
|
+
yield page
|
25
|
+
end
|
26
|
+
else
|
27
|
+
get("users?start_cursor=#{options[:start_cursor]}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Notion
|
4
|
+
module Api
|
5
|
+
module Errors
|
6
|
+
class InternalError < NotionError; end
|
7
|
+
class InvalidRequest < NotionError; end
|
8
|
+
class ObjectNotFound < NotionError; end
|
9
|
+
class TooManyRequests < NotionError; end
|
10
|
+
|
11
|
+
ERROR_CLASSES = {
|
12
|
+
'internal_error' => InternalError,
|
13
|
+
'invalid_request' => InvalidRequest,
|
14
|
+
'object_not_found' => ObjectNotFound,
|
15
|
+
'rate_limited' => TooManyRequests
|
16
|
+
}.freeze
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Api
|
4
|
+
module Errors
|
5
|
+
class ServerError < InternalError; end
|
6
|
+
class ParsingError < ServerError; end
|
7
|
+
class HttpRequestError < ServerError; end
|
8
|
+
class TimeoutError < HttpRequestError; end
|
9
|
+
class UnavailableError < HttpRequestError; end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Api
|
4
|
+
module Errors
|
5
|
+
class NotionError < ::Faraday::Error
|
6
|
+
attr_reader :response
|
7
|
+
|
8
|
+
def initialize(message, response = nil)
|
9
|
+
super message
|
10
|
+
@response = response
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
class Client
|
4
|
+
include Faraday::Connection
|
5
|
+
include Faraday::Request
|
6
|
+
include Api::Endpoints
|
7
|
+
|
8
|
+
attr_accessor(*Config::ATTRIBUTES)
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
Notion::Config::ATTRIBUTES.each do |key|
|
12
|
+
send("#{key}=", options.fetch(key, Notion.config.send(key)))
|
13
|
+
end
|
14
|
+
@logger ||= Notion::Config.logger || Notion::Logger.default
|
15
|
+
@token ||= Notion.config.token
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def configure
|
20
|
+
block_given? ? yield(Config) : Config
|
21
|
+
end
|
22
|
+
|
23
|
+
def config
|
24
|
+
Config
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Config
|
4
|
+
extend self
|
5
|
+
|
6
|
+
ATTRIBUTES = %i[
|
7
|
+
proxy
|
8
|
+
user_agent
|
9
|
+
ca_path
|
10
|
+
ca_file
|
11
|
+
logger
|
12
|
+
endpoint
|
13
|
+
token
|
14
|
+
timeout
|
15
|
+
open_timeout
|
16
|
+
default_page_size
|
17
|
+
default_max_retries
|
18
|
+
adapter
|
19
|
+
].freeze
|
20
|
+
|
21
|
+
attr_accessor(*Config::ATTRIBUTES)
|
22
|
+
|
23
|
+
def reset
|
24
|
+
self.endpoint = 'https://api.notion.com/v1'
|
25
|
+
self.user_agent = "Notion Ruby Client/#{Notion::VERSION}"
|
26
|
+
self.ca_path = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_DIR : nil
|
27
|
+
self.ca_file = defined?(OpenSSL) ? OpenSSL::X509::DEFAULT_CERT_FILE : nil
|
28
|
+
self.token = nil
|
29
|
+
self.proxy = nil
|
30
|
+
self.logger = nil
|
31
|
+
self.timeout = nil
|
32
|
+
self.open_timeout = nil
|
33
|
+
self.default_page_size = 100
|
34
|
+
self.default_max_retries = 100
|
35
|
+
self.adapter = ::Faraday.default_adapter
|
36
|
+
end
|
37
|
+
|
38
|
+
reset
|
39
|
+
end
|
40
|
+
|
41
|
+
class << self
|
42
|
+
def configure
|
43
|
+
block_given? ? yield(Config) : Config
|
44
|
+
end
|
45
|
+
|
46
|
+
def config
|
47
|
+
Config
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Faraday
|
4
|
+
module Connection
|
5
|
+
private
|
6
|
+
|
7
|
+
def connection
|
8
|
+
@connection ||=
|
9
|
+
begin
|
10
|
+
options = {
|
11
|
+
headers: { 'Accept' => 'application/json; charset=utf-8' }
|
12
|
+
}
|
13
|
+
|
14
|
+
options[:headers]['User-Agent'] = user_agent if user_agent
|
15
|
+
options[:proxy] = proxy if proxy
|
16
|
+
options[:ssl] = { ca_path: ca_path, ca_file: ca_file } if ca_path || ca_file
|
17
|
+
|
18
|
+
request_options = {}
|
19
|
+
request_options[:timeout] = timeout if timeout
|
20
|
+
request_options[:open_timeout] = open_timeout if open_timeout
|
21
|
+
options[:request] = request_options if request_options.any?
|
22
|
+
|
23
|
+
::Faraday::Connection.new(endpoint, options) do |connection|
|
24
|
+
connection.use ::Faraday::Request::Multipart
|
25
|
+
connection.use ::Faraday::Request::UrlEncoded
|
26
|
+
connection.use ::Notion::Faraday::Response::RaiseError
|
27
|
+
connection.use ::FaradayMiddleware::Mashify, mash_class: Notion::Messages::Message
|
28
|
+
connection.use ::FaradayMiddleware::ParseJson
|
29
|
+
connection.use ::Notion::Faraday::Response::WrapError
|
30
|
+
connection.response :logger, logger if logger
|
31
|
+
connection.adapter adapter
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Faraday
|
4
|
+
module Request
|
5
|
+
def get(path, options = {})
|
6
|
+
request(:get, path, options)
|
7
|
+
end
|
8
|
+
|
9
|
+
def post(path, options = {})
|
10
|
+
request(:post, path, options)
|
11
|
+
end
|
12
|
+
|
13
|
+
def put(path, options = {})
|
14
|
+
request(:put, path, options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def delete(path, options = {})
|
18
|
+
request(:delete, path, options)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def request(method, path, options)
|
24
|
+
response = connection.send(method) do |request|
|
25
|
+
request.headers['Authorization'] = "Bearer #{token}"
|
26
|
+
case method
|
27
|
+
when :get, :delete
|
28
|
+
request.url(path, options)
|
29
|
+
when :post, :put
|
30
|
+
request.path = path
|
31
|
+
request.body = options unless options.empty?
|
32
|
+
end
|
33
|
+
request.options.merge!(options.delete(:request)) if options.key?(:request)
|
34
|
+
end
|
35
|
+
response.body
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Faraday
|
4
|
+
module Response
|
5
|
+
class RaiseError < ::Faraday::Response::Middleware
|
6
|
+
def on_complete(env)
|
7
|
+
raise Notion::Api::Errors::TooManyRequests, env.response if env.status == 429
|
8
|
+
|
9
|
+
return unless env.success?
|
10
|
+
|
11
|
+
body = env.body
|
12
|
+
return unless body
|
13
|
+
return if env.status == 200
|
14
|
+
|
15
|
+
error_code = body['code']
|
16
|
+
error_message = body['message']
|
17
|
+
error_message = body['details']
|
18
|
+
|
19
|
+
error_class = Notion::Api::Errors::ERROR_CLASSES[error_code]
|
20
|
+
error_class ||= Notion::Api::Errors::NotionError
|
21
|
+
raise error_class.new(error_message, env.response)
|
22
|
+
end
|
23
|
+
|
24
|
+
def call(env)
|
25
|
+
super
|
26
|
+
rescue ::Faraday::ParsingError
|
27
|
+
raise Notion::Api::Errors::ParsingError.new('parsing_error', env.response)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Faraday
|
4
|
+
module Response
|
5
|
+
class WrapError < ::Faraday::Response::Middleware
|
6
|
+
UNAVAILABLE_ERROR_STATUSES = (500..599).freeze
|
7
|
+
|
8
|
+
def on_complete(env)
|
9
|
+
return unless UNAVAILABLE_ERROR_STATUSES.cover?(env.status)
|
10
|
+
|
11
|
+
raise Notion::Api::Errors::UnavailableError.new('unavailable_error', env.response)
|
12
|
+
end
|
13
|
+
|
14
|
+
def call(env)
|
15
|
+
super
|
16
|
+
rescue ::Faraday::TimeoutError, ::Faraday::ConnectionFailed
|
17
|
+
raise Notion::Api::Errors::TimeoutError.new('timeout_error', env.response)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Messages
|
4
|
+
class Message < Hashie::Mash
|
5
|
+
def to_s
|
6
|
+
keys.sort_by(&:to_s).map do |key|
|
7
|
+
"#{key}=#{self[key]}"
|
8
|
+
end.join(', ')
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
# see https://github.com/intridea/hashie/issues/394
|
14
|
+
def log_built_in_message(*); end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Notion
|
3
|
+
module Api
|
4
|
+
module Pagination
|
5
|
+
class Cursor
|
6
|
+
include Enumerable
|
7
|
+
|
8
|
+
attr_reader :client
|
9
|
+
attr_reader :verb
|
10
|
+
attr_reader :sleep_interval
|
11
|
+
attr_reader :max_retries
|
12
|
+
attr_reader :params
|
13
|
+
|
14
|
+
def initialize(client, verb, params = {})
|
15
|
+
@client = client
|
16
|
+
@verb = verb
|
17
|
+
@params = params.dup
|
18
|
+
@sleep_interval = @params.delete(:sleep_interval)
|
19
|
+
@max_retries = @params.delete(:max_retries) || client.default_max_retries
|
20
|
+
end
|
21
|
+
|
22
|
+
def each
|
23
|
+
next_cursor = nil
|
24
|
+
retry_count = 0
|
25
|
+
loop do
|
26
|
+
query = { limit: client.default_page_size }.merge(params).merge(start_cursor: next_cursor)
|
27
|
+
begin
|
28
|
+
response = client.send(verb, query)
|
29
|
+
rescue Notion::Api::Errors::TooManyRequestsError => e
|
30
|
+
raise e if retry_count >= max_retries
|
31
|
+
|
32
|
+
client.logger.debug("#{self.class}##{__method__}") { e.to_s }
|
33
|
+
retry_count += 1
|
34
|
+
sleep(e.retry_after)
|
35
|
+
next
|
36
|
+
end
|
37
|
+
yield response
|
38
|
+
break unless response.has_more
|
39
|
+
|
40
|
+
next_cursor = response.next_cursor
|
41
|
+
break if next_cursor.nil? || next_cursor == ''
|
42
|
+
|
43
|
+
retry_count = 0
|
44
|
+
sleep(sleep_interval) if sleep_interval
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
3
|
+
require 'notion/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'notion-ruby-client'
|
7
|
+
s.version = Notion::VERSION
|
8
|
+
s.authors = ['Nicolas Goutay']
|
9
|
+
s.email = 'nicolas@orbit.love'
|
10
|
+
s.platform = Gem::Platform::RUBY
|
11
|
+
s.required_rubygems_version = '>= 1.3.6'
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
14
|
+
s.require_paths = ['lib']
|
15
|
+
s.homepage = 'http://github.com/orbit-love/notion-ruby-client'
|
16
|
+
s.licenses = ['MIT']
|
17
|
+
s.summary = 'Notion API client for Ruby.'
|
18
|
+
s.add_dependency 'faraday', '>= 1.0'
|
19
|
+
s.add_dependency 'faraday_middleware'
|
20
|
+
s.add_dependency 'hashie'
|
21
|
+
s.add_development_dependency 'rake', '~> 10'
|
22
|
+
s.add_development_dependency 'rspec'
|
23
|
+
s.add_development_dependency 'rubocop', '~> 0.82.0'
|
24
|
+
s.add_development_dependency 'rubocop-performance', '~> 1.5.2'
|
25
|
+
s.add_development_dependency 'rubocop-rspec', '~> 1.39.0'
|
26
|
+
s.add_development_dependency 'timecop'
|
27
|
+
s.add_development_dependency 'vcr'
|
28
|
+
s.add_development_dependency 'webmock'
|
29
|
+
end
|
data/scratchpad.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Notion.configure do |config|
|
2
|
+
config.token = ENV['NOTION_API_TOKEN']
|
3
|
+
end
|
4
|
+
|
5
|
+
client = Notion::Client.new(token: 'token')
|
6
|
+
|
7
|
+
|
8
|
+
client = Notion::Client.new
|
9
|
+
client.auth_test
|
10
|
+
|
11
|
+
client.database(id)
|
12
|
+
client.database_query(id, options)
|
13
|
+
|
14
|
+
client.page(id)
|
15
|
+
client.create_page(options)
|
16
|
+
client.update_page(id, options)
|
17
|
+
|
18
|
+
client.user(id)
|
19
|
+
client.list_users(options)
|
20
|
+
|
21
|
+
|
22
|
+
# https://c15c8970-daea-4c88-9bcd-93726522a93e.mock.pstmn.io
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,221 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: notion-ruby-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicolas Goutay
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: hashie
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.82.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.82.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-performance
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.5.2
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.5.2
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.39.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.39.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: timecop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: vcr
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: webmock
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description:
|
168
|
+
email: nicolas@orbit.love
|
169
|
+
executables: []
|
170
|
+
extensions: []
|
171
|
+
extra_rdoc_files: []
|
172
|
+
files:
|
173
|
+
- Gemfile
|
174
|
+
- LICENSE.md
|
175
|
+
- README.md
|
176
|
+
- lib/notion-ruby-client.rb
|
177
|
+
- lib/notion.rb
|
178
|
+
- lib/notion/api/endpoints.rb
|
179
|
+
- lib/notion/api/endpoints/users.rb
|
180
|
+
- lib/notion/api/error.rb
|
181
|
+
- lib/notion/api/errors.rb
|
182
|
+
- lib/notion/api/errors/internal_error.rb
|
183
|
+
- lib/notion/api/errors/notion_error.rb
|
184
|
+
- lib/notion/client.rb
|
185
|
+
- lib/notion/config.rb
|
186
|
+
- lib/notion/faraday/connection.rb
|
187
|
+
- lib/notion/faraday/request.rb
|
188
|
+
- lib/notion/faraday/response/raise_error.rb
|
189
|
+
- lib/notion/faraday/response/wrap_error.rb
|
190
|
+
- lib/notion/logger.rb
|
191
|
+
- lib/notion/messages/message.rb
|
192
|
+
- lib/notion/pagination/cursor.rb
|
193
|
+
- lib/notion/version.rb
|
194
|
+
- lib/notion_ruby_client.rb
|
195
|
+
- notion-ruby-client.gemspec
|
196
|
+
- scratchpad.rb
|
197
|
+
- screenshots/create_notion_bot.png
|
198
|
+
homepage: http://github.com/orbit-love/notion-ruby-client
|
199
|
+
licenses:
|
200
|
+
- MIT
|
201
|
+
metadata: {}
|
202
|
+
post_install_message:
|
203
|
+
rdoc_options: []
|
204
|
+
require_paths:
|
205
|
+
- lib
|
206
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
207
|
+
requirements:
|
208
|
+
- - ">="
|
209
|
+
- !ruby/object:Gem::Version
|
210
|
+
version: '0'
|
211
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: 1.3.6
|
216
|
+
requirements: []
|
217
|
+
rubygems_version: 3.1.4
|
218
|
+
signing_key:
|
219
|
+
specification_version: 4
|
220
|
+
summary: Notion API client for Ruby.
|
221
|
+
test_files: []
|