notionrb 1.3.0

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.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.devcontainer/Dockerfile +5 -0
  3. data/.devcontainer/boot.sh +1 -0
  4. data/.devcontainer/devcontainer.json +30 -0
  5. data/.github/workflows/ci.yml +15 -0
  6. data/.github/workflows/rubocop.yml +17 -0
  7. data/.gitignore +7 -0
  8. data/.rspec +2 -0
  9. data/.rubocop.yml +55 -0
  10. data/.rubocop_todo.yml +86 -0
  11. data/CHANGELOG.md +144 -0
  12. data/CODE_OF_CONDUCT.md +128 -0
  13. data/CONTRIBUTING.md +51 -0
  14. data/Gemfile +4 -0
  15. data/Gemfile.lock +95 -0
  16. data/LICENSE.md +21 -0
  17. data/README.md +677 -0
  18. data/Rakefile +18 -0
  19. data/bin/console +31 -0
  20. data/lib/notion/api/endpoints/blocks.rb +100 -0
  21. data/lib/notion/api/endpoints/comments.rb +61 -0
  22. data/lib/notion/api/endpoints/data_sources.rb +102 -0
  23. data/lib/notion/api/endpoints/databases.rb +134 -0
  24. data/lib/notion/api/endpoints/pages.rb +95 -0
  25. data/lib/notion/api/endpoints/search.rb +41 -0
  26. data/lib/notion/api/endpoints/users.rb +48 -0
  27. data/lib/notion/api/endpoints.rb +23 -0
  28. data/lib/notion/api/error.rb +6 -0
  29. data/lib/notion/api/errors/internal_error.rb +12 -0
  30. data/lib/notion/api/errors/notion_error.rb +15 -0
  31. data/lib/notion/api/errors/too_many_requests.rb +15 -0
  32. data/lib/notion/api/errors.rb +23 -0
  33. data/lib/notion/client.rb +28 -0
  34. data/lib/notion/config.rb +54 -0
  35. data/lib/notion/faraday/connection.rb +37 -0
  36. data/lib/notion/faraday/request.rb +45 -0
  37. data/lib/notion/faraday/response/raise_error.rb +31 -0
  38. data/lib/notion/faraday/response/wrap_error.rb +22 -0
  39. data/lib/notion/logger.rb +14 -0
  40. data/lib/notion/messages/message.rb +17 -0
  41. data/lib/notion/pagination/cursor.rb +53 -0
  42. data/lib/notion/version.rb +5 -0
  43. data/lib/notion-ruby-client.rb +28 -0
  44. data/lib/notion.rb +2 -0
  45. data/lib/notion_ruby_client.rb +2 -0
  46. data/notionrb.gemspec +31 -0
  47. data/spec/fixtures/notion/block.yml +146 -0
  48. data/spec/fixtures/notion/block_append_children.yml +149 -0
  49. data/spec/fixtures/notion/block_children.yml +152 -0
  50. data/spec/fixtures/notion/create_data_source.yml +29 -0
  51. data/spec/fixtures/notion/create_database.yml +149 -0
  52. data/spec/fixtures/notion/create_discussion_comment.yml +110 -0
  53. data/spec/fixtures/notion/create_page.yml +152 -0
  54. data/spec/fixtures/notion/create_page_comment.yml +110 -0
  55. data/spec/fixtures/notion/create_page_with_data_source.yml +29 -0
  56. data/spec/fixtures/notion/create_page_with_parent_page.yml +128 -0
  57. data/spec/fixtures/notion/data_source.yml +27 -0
  58. data/spec/fixtures/notion/data_source_query.yml +29 -0
  59. data/spec/fixtures/notion/database.yml +150 -0
  60. data/spec/fixtures/notion/database_query.yml +154 -0
  61. data/spec/fixtures/notion/delete_block.yml +145 -0
  62. data/spec/fixtures/notion/page.yml +150 -0
  63. data/spec/fixtures/notion/page_property_item.yml +143 -0
  64. data/spec/fixtures/notion/paginated_block_children.yml +575 -0
  65. data/spec/fixtures/notion/paginated_data_source_query.yml +29 -0
  66. data/spec/fixtures/notion/paginated_database_query.yml +152 -0
  67. data/spec/fixtures/notion/paginated_databases_list.yml +150 -0
  68. data/spec/fixtures/notion/paginated_search.yml +301 -0
  69. data/spec/fixtures/notion/paginated_users_list.yml +146 -0
  70. data/spec/fixtures/notion/retrieve_comments.yml +106 -0
  71. data/spec/fixtures/notion/search.yml +160 -0
  72. data/spec/fixtures/notion/search_with_query.yml +152 -0
  73. data/spec/fixtures/notion/update_block.yml +148 -0
  74. data/spec/fixtures/notion/update_data_source.yml +29 -0
  75. data/spec/fixtures/notion/update_database.yml +152 -0
  76. data/spec/fixtures/notion/update_page.yml +152 -0
  77. data/spec/fixtures/notion/users.yml +145 -0
  78. data/spec/fixtures/notion/users_list.yml +146 -0
  79. data/spec/fixtures/notion/users_me.yml +144 -0
  80. data/spec/notion/api/endpoints/blocks_spec.rb +72 -0
  81. data/spec/notion/api/endpoints/comments_spec.rb +49 -0
  82. data/spec/notion/api/endpoints/data_sources_spec.rb +61 -0
  83. data/spec/notion/api/endpoints/databases_spec.rb +70 -0
  84. data/spec/notion/api/endpoints/pages_spec.rb +127 -0
  85. data/spec/notion/api/endpoints/search_spec.rb +26 -0
  86. data/spec/notion/api/endpoints/users_spec.rb +31 -0
  87. data/spec/notion/config_spec.rb +16 -0
  88. data/spec/notion/pagination/cursor_spec.rb +126 -0
  89. data/spec/notion/version_spec.rb +8 -0
  90. data/spec/spec_helper.rb +22 -0
  91. data/spec/support/token.rb +10 -0
  92. data/spec/support/vcr.rb +16 -0
  93. metadata +358 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: '09efbfad64cfa84174611740e68c801b0e5737b5ed5187b35cf9a6a01c2f0491'
4
+ data.tar.gz: 024443e093523b3162d157be7221fb9fb2ed510d7d1168d2c5c3c3abba983d99
5
+ SHA512:
6
+ metadata.gz: 65f13a6b761a0ef4f865da6b62c9132446fdb8d49709d1f11cd1114840148945c319738031ccf9c6527a4ff7da527813238ff9f70514f217a66bc30ea32a61e6
7
+ data.tar.gz: 1f16e90f654bb20e41252bd26f1a80407c02ae69050d5775c5e94c929078eb0c231aa24d006b9bcaf392936e2b55a0304aa8b4c2e44bce02ff658bec66e4e778
@@ -0,0 +1,5 @@
1
+ # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby/.devcontainer/base.Dockerfile
2
+
3
+ # [Choice] Ruby version: 3, 3.0, 2, 2.7, 2.6
4
+ ARG VARIANT="3.0"
5
+ FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT}
@@ -0,0 +1 @@
1
+ bundle install
@@ -0,0 +1,30 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2
+ // https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby
3
+ {
4
+ "name": "Ruby",
5
+ "build": {
6
+ "dockerfile": "Dockerfile",
7
+ "context": "..",
8
+ "args": {
9
+ // Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6
10
+ "VARIANT": "2.7",
11
+ }
12
+ },
13
+
14
+ // Set *default* container specific settings.json values on container create.
15
+ "settings": {},
16
+
17
+ // Add the IDs of extensions you want installed when the container is created.
18
+ "extensions": [
19
+ "rebornix.Ruby"
20
+ ],
21
+
22
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
23
+ // "forwardPorts": [],
24
+
25
+ // Use 'postCreateCommand' to run commands after the container is created.
26
+ "postCreateCommand": ".devcontainer/boot.sh",
27
+
28
+ // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
29
+ "remoteUser": "vscode"
30
+ }
@@ -0,0 +1,15 @@
1
+ on: [push, pull_request]
2
+ name: Continuous Integration
3
+ jobs:
4
+ test:
5
+ strategy:
6
+ matrix:
7
+ ruby: [2.6, 2.7, '3.0', 3.1, 3.2]
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - uses: ruby/setup-ruby@v1
12
+ with:
13
+ bundler-cache: true
14
+ ruby-version: ${{ matrix.ruby }}
15
+ - run: bundle exec rake spec
@@ -0,0 +1,17 @@
1
+ name: RuboCop
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - uses: actions/checkout@v3
11
+ - name: Set up Ruby
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: 2.7
15
+ bundler-cache: true # 'bundle install' and cache
16
+ - name: Run RuboCop
17
+ run: bundle exec rake rubocop
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .env
2
+ pkg
3
+ Gemfile.lock
4
+ .DS_Store
5
+ .bundle
6
+ .idea
7
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,55 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-performance
5
+ - rubocop-rspec
6
+
7
+ AllCops:
8
+ DisplayCopNames: true
9
+ Exclude:
10
+ - bin/**/*
11
+ - vendor/**/*
12
+ - lib/notion/web/api/notion-api-ref/**/*
13
+ - lib/notion/web/api/endpoints/* # Auto-generated
14
+ - lib/notion/web/api/errors.rb # Auto-generated
15
+ - spec/notion/web/api/endpoints/* # Auto-generated
16
+
17
+ Layout/EmptyLineAfterMagicComment:
18
+ Enabled: false
19
+
20
+ Metrics/BlockLength:
21
+ Enabled: false
22
+
23
+ Metrics/ClassLength:
24
+ Max: 250
25
+
26
+ Layout/LineLength:
27
+ Max: 128
28
+
29
+ RSpec/ContextWording:
30
+ Enabled: false
31
+
32
+ RSpec/ExampleLength:
33
+ Enabled: false
34
+
35
+ RSpec/MultipleExpectations:
36
+ Enabled: false
37
+
38
+ RSpec/FilePath:
39
+ Enabled: false
40
+
41
+ RSpec/MessageSpies:
42
+ Enabled: false
43
+
44
+ RSpec/NestedGroups:
45
+ Max: 5
46
+
47
+ Style/Documentation:
48
+ Enabled: false
49
+
50
+ Style/ModuleFunction:
51
+ Enabled: false
52
+
53
+ Naming/FileName:
54
+ Exclude:
55
+ - lib/notion-ruby-client.rb # Required to match gemspec name
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,86 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2021-04-25 19:55:01 +0200 using RuboCop version 0.82.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 3
10
+ # Cop supports --auto-correct.
11
+ Layout/EmptyLines:
12
+ Exclude:
13
+ - 'scratchpad.rb'
14
+ - 'spec/spec_helper.rb'
15
+
16
+ # Offense count: 5
17
+ # Configuration parameters: EnforcedStyle.
18
+ # SupportedStyles: native, lf, crlf
19
+ Layout/EndOfLine:
20
+ Exclude:
21
+ - 'Rakefile'
22
+ - 'spec/notion/config_spec.rb'
23
+ - 'spec/notion/version_spec.rb'
24
+ - 'spec/spec_helper.rb'
25
+ - 'spec/support/token.rb'
26
+
27
+ # Offense count: 26
28
+ # Cop supports --auto-correct.
29
+ # Configuration parameters: EnforcedStyle.
30
+ # SupportedStyles: final_newline, final_blank_line
31
+ Layout/TrailingEmptyLines:
32
+ Enabled: false
33
+
34
+ # Offense count: 1
35
+ # Cop supports --auto-correct.
36
+ Lint/NonDeterministicRequireOrder:
37
+ Exclude:
38
+ - 'spec/spec_helper.rb'
39
+
40
+ # Offense count: 1
41
+ Lint/UselessAssignment:
42
+ Exclude:
43
+ - 'scratchpad.rb'
44
+
45
+ # Offense count: 2
46
+ # Configuration parameters: IgnoredMethods.
47
+ Metrics/AbcSize:
48
+ Max: 30
49
+
50
+ # Offense count: 2
51
+ # Configuration parameters: IgnoredMethods.
52
+ Metrics/CyclomaticComplexity:
53
+ Max: 9
54
+
55
+ # Offense count: 4
56
+ # Configuration parameters: CountComments, ExcludedMethods.
57
+ Metrics/MethodLength:
58
+ Max: 23
59
+
60
+ # Offense count: 2
61
+ # Configuration parameters: IgnoredMethods.
62
+ Metrics/PerceivedComplexity:
63
+ Max: 9
64
+
65
+ # Offense count: 2
66
+ # Configuration parameters: AllowedChars.
67
+ Style/AsciiComments:
68
+ Exclude:
69
+ - 'lib/notion/api/endpoints/pages.rb'
70
+
71
+ # Offense count: 1
72
+ # Cop supports --auto-correct.
73
+ # Configuration parameters: EnforcedStyle.
74
+ # SupportedStyles: always, always_true, never
75
+ Style/FrozenStringLiteralComment:
76
+ Exclude:
77
+ - 'scratchpad.rb'
78
+
79
+ # Offense count: 2
80
+ # Cop supports --auto-correct.
81
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
82
+ # SupportedStyles: single_quotes, double_quotes
83
+ Style/StringLiterals:
84
+ Exclude:
85
+ - 'lib/notion/api/endpoints/pages.rb'
86
+ - 'lib/notion/api/endpoints/users.rb'
data/CHANGELOG.md ADDED
@@ -0,0 +1,144 @@
1
+ ### 1.3.0 (unreleased)
2
+
3
+ #### Breaking changes
4
+
5
+ - Bump the Notion API version to `2025-09-03`. Databases can now contain multiple data sources; querying and schema updates happen against a data source id, not a database id.
6
+
7
+ #### New
8
+
9
+ - Add support for the Data sources endpoints: `data_source_query`, `create_data_source`, `update_data_source`, `data_source`.
10
+ - `create_page` accepts `parent: { data_source_id: ... }`.
11
+ - `create_database` accepts `initial_data_source:` (still accepts a bare `properties:` for backward compatibility, wrapped automatically).
12
+
13
+ #### Deprecated
14
+
15
+ - `database_query` now logs a deprecation warning; use `data_source_query`.
16
+
17
+ ### 1.2.2 (2023-10-02)
18
+
19
+ #### Improved
20
+
21
+ - Remove `dotenv` as a runtime dependency (@sinsoku, #49)
22
+ - Remove the outdated mention of the List Databases enpoint in the README (@soruma, #48)
23
+
24
+ ### 1.2.1 (2023-02-26)
25
+
26
+ #### New
27
+
28
+ - Add support for creating a page as child of another page (thanks @TABeauchat!)
29
+
30
+ ### 1.2.0 (2023-02-26)
31
+
32
+ #### New
33
+
34
+ - Add support for the following new endpoints (thanks @themoffatt!):
35
+ - [Create comment](https://developers.notion.com/reference/create-a-comment)
36
+ - [Retrieve comments](https://developers.notion.com/reference/retrieve-a-comment)
37
+
38
+ ### 1.1.0 (2023-02-23)
39
+
40
+ #### Breaking changes
41
+
42
+ - Remove support for ruby 2.5
43
+ - Remove the `activesupport` dependency. Add `gem 'activesupport'` to your Gemfile if you required ActiveSupport via this library.
44
+
45
+ #### Other
46
+
47
+ - Upgrade Faraday to v2 (thanks @Tao-Galasse!)
48
+
49
+ ### 1.0.0 (2022-03-30)
50
+
51
+ #### New
52
+
53
+ - Add support for the following new endpoints:
54
+ - [Delete a block](https://developers.notion.com/reference/get-block-children)
55
+ - [Retrieve your token's bot user](https://developers.notion.com/reference/get-self)
56
+ - [Retrieve a page property item](https://developers.notion.com/reference/retrieve-a-page-property)
57
+ - Update Notion API Version to `2022-02-22` (thanks @hkob!)
58
+ - Remove the following deprecated endpoint:
59
+ - [List databases](https://developers.notion.com/reference/get-databases)
60
+ - Add Codespaces and CONTRIBUTING.md command for better DX
61
+ - Overhauled documentation
62
+
63
+ ### Upgrade instructions
64
+
65
+ - Please refer to the Notion Changelog to see breaking changes for version `2022-02-22`: https://developers.notion.com/changelog/releasing-notion-version-2022-02-22
66
+
67
+ ### 1.0.0-beta2 (2022-03-24)
68
+
69
+ #### Fixed
70
+
71
+ Fixed compat with Rails 7
72
+
73
+ ### 1.0.0-beta1 (2022-03-24)
74
+
75
+ #### New
76
+
77
+ - Add support for the following new endpoints:
78
+ - [Delete a block](https://developers.notion.com/reference/get-block-children)
79
+ - [Retrieve your token's bot user](https://developers.notion.com/reference/get-self)
80
+ - [Retrieve a page property item](https://developers.notion.com/reference/retrieve-a-page-property)
81
+ - Update Notion API Version to `2022-02-22` (thanks @hkob!)
82
+ - Remove the following deprecated endpoint:
83
+ - [List databases](https://developers.notion.com/reference/get-databases)
84
+ - Add Codespaces and CONTRIBUTING.md command for better DX
85
+ - Overhauled documentation
86
+
87
+ #### Upgrade instructions
88
+
89
+ - Please refer to the Notion Changelog to see breaking changes for version `2022-02-22`: https://developers.notion.com/changelog/releasing-notion-version-2022-02-22
90
+
91
+ ### 0.1.0-beta1 (2021-08-29)
92
+
93
+ #### New
94
+
95
+ - Add support for the following new endpoints:
96
+ - [Update database](https://developers.notion.com/reference/update-a-database)
97
+ - [Update page](https://developers.notion.com/reference/patch-page)
98
+ - [Retrieve a block](https://developers.notion.com/reference/retrieve-a-block)
99
+ - [Update a block](https://developers.notion.com/reference/update-a-block)
100
+ - [Search](https://developers.notion.com/reference/search)
101
+ - Update Notion API Version to `2021-08-16`
102
+ - Add `bin/console` command for better DX
103
+ - Overhauled documentation
104
+
105
+ #### Upgrade instructions
106
+
107
+ - Please refer to the Notion Changelog to see breaking changes for version `2021-08-16`
108
+ - Regarding this gem, a lot of `id` parameters got renamed to `block_id`, `page_id`, `user_id` and `database_id`. You might need to rename those in your code as well.
109
+
110
+ ### 0.0.8 (2021-07-27)
111
+
112
+ - Bump `Notion-Version` header to `2021-05-13` (@H0R15H0)
113
+ - Add support for the new Create database endpoint (@H0R15H0)
114
+
115
+ ### 0.0.7 (2021-06-17)
116
+
117
+ - Fixes the query parameter for fetching a page resource
118
+
119
+ ### 0.0.6 (2021-06-09)
120
+
121
+ - Added `Notion-Version` required header to all requests
122
+
123
+ ### 0.0.5 (2020-04-25)
124
+
125
+ - Added support for Blocks endpoints
126
+
127
+ ### 0.0.4 (2020-04-25)
128
+
129
+ - Added specs and a CI process with GitHub Actions
130
+ - Added support for GET /databases, POST /databases/<:id>/query endpoints
131
+ - Added support for `content` when creating a page
132
+
133
+ ### 0.0.3 (2020-01-30)
134
+
135
+ - The gem now covers all available endpoints to date
136
+ - Better error handling and logging
137
+
138
+ ### 0.0.2 (2020-01-29)
139
+
140
+ - Fixed blocking bug present in 0.0.1
141
+
142
+ ### 0.0.1 (2020-01-29)
143
+
144
+ - Initial alpha public release. Suffers from a bug that prevents installation.
@@ -0,0 +1,128 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ nicolas@orbit.love.
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120
+
121
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
122
+ enforcement ladder](https://github.com/mozilla/diversity).
123
+
124
+ [homepage]: https://www.contributor-covenant.org
125
+
126
+ For answers to common questions about this code of conduct, see the FAQ at
127
+ https://www.contributor-covenant.org/faq. Translations are available at
128
+ https://www.contributor-covenant.org/translations.
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,51 @@
1
+ # CONTRIBUTING
2
+
3
+ _This project is intended to be a safe, welcoming space for collaboration. By participating in this project you agree to abide by the [Contributor Code of Conduct](CODE_OF_CONDUCT.md)._
4
+
5
+ Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
6
+
7
+ ## Running the project
8
+
9
+ ### GitHub Codespaces
10
+
11
+ This repository includes configuration for GitHub Codespaces, making it easy to set up a cloud-based development environment. Follow [GitHub's guide](https://docs.github.com/en/codespaces/developing-in-codespaces/creating-a-codespace#creating-a-codespace) to get started.
12
+
13
+ The Codespaces environment has the dependencies all installed, and should be ready to tinker with. Once your Codespace is set up, you can check that everything works as intended by running the specs:
14
+
15
+ ```
16
+ bundle exec rake
17
+ ```
18
+
19
+ ### Running the project locally
20
+
21
+ You can also install the project on your machine:
22
+
23
+ ```
24
+ git clone https://github.com/phacks/notion-ruby-client.git
25
+ cd notion-ruby-client
26
+ # if you do not have bundler installed already, run
27
+ # $ gem install bundle
28
+ # to install it
29
+ bundle install
30
+ ```
31
+
32
+ You can check that everything works as intended by running the specs:
33
+
34
+ ```
35
+ bundle exec rake
36
+ ```
37
+
38
+ ## Interactive console
39
+
40
+ You can run
41
+
42
+ ```
43
+ bin/console
44
+ ```
45
+
46
+ to start an IRB (interactive Ruby console) session with all the gem files loaded.
47
+ Usually, you’d start such sessions by defining your `client`:
48
+
49
+ ```
50
+ client = Notion::Client.new(token: <Your Notion API token>)
51
+ ```
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+ source 'http://rubygems.org'
3
+
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,95 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ notionrb (1.3.0)
5
+ faraday (>= 2.0)
6
+ faraday-mashify (>= 0.1.1)
7
+ faraday-multipart (>= 1.0.4)
8
+ hashie (~> 5)
9
+
10
+ GEM
11
+ remote: http://rubygems.org/
12
+ specs:
13
+ addressable (2.8.0)
14
+ public_suffix (>= 2.0.2, < 5.0)
15
+ ast (2.4.2)
16
+ base64 (0.3.0)
17
+ crack (0.4.5)
18
+ rexml
19
+ diff-lcs (1.4.4)
20
+ dotenv (2.8.1)
21
+ faraday (2.8.1)
22
+ base64
23
+ faraday-net_http (>= 2.0, < 3.1)
24
+ ruby2_keywords (>= 0.0.4)
25
+ faraday-mashify (0.1.1)
26
+ faraday (~> 2.0)
27
+ hashie
28
+ faraday-multipart (1.0.4)
29
+ multipart-post (~> 2)
30
+ faraday-net_http (3.0.2)
31
+ hashdiff (1.0.1)
32
+ hashie (5.0.0)
33
+ jaro_winkler (1.5.4)
34
+ multipart-post (2.3.0)
35
+ parallel (1.20.1)
36
+ parser (3.0.1.1)
37
+ ast (~> 2.4.1)
38
+ public_suffix (4.0.6)
39
+ rainbow (3.0.0)
40
+ rake (13.0.6)
41
+ rexml (3.2.5)
42
+ rspec (3.10.0)
43
+ rspec-core (~> 3.10.0)
44
+ rspec-expectations (~> 3.10.0)
45
+ rspec-mocks (~> 3.10.0)
46
+ rspec-core (3.10.1)
47
+ rspec-support (~> 3.10.0)
48
+ rspec-expectations (3.10.1)
49
+ diff-lcs (>= 1.2.0, < 2.0)
50
+ rspec-support (~> 3.10.0)
51
+ rspec-mocks (3.10.2)
52
+ diff-lcs (>= 1.2.0, < 2.0)
53
+ rspec-support (~> 3.10.0)
54
+ rspec-support (3.10.2)
55
+ rubocop (0.82.0)
56
+ jaro_winkler (~> 1.5.1)
57
+ parallel (~> 1.10)
58
+ parser (>= 2.7.0.1)
59
+ rainbow (>= 2.2.2, < 4.0)
60
+ rexml
61
+ ruby-progressbar (~> 1.7)
62
+ unicode-display_width (>= 1.4.0, < 2.0)
63
+ rubocop-performance (1.5.2)
64
+ rubocop (>= 0.71.0)
65
+ rubocop-rspec (1.39.0)
66
+ rubocop (>= 0.68.1)
67
+ ruby-progressbar (1.11.0)
68
+ ruby2_keywords (0.0.5)
69
+ timecop (0.9.4)
70
+ unicode-display_width (1.7.0)
71
+ vcr (6.0.0)
72
+ webmock (3.13.0)
73
+ addressable (>= 2.3.6)
74
+ crack (>= 0.3.2)
75
+ hashdiff (>= 0.4.0, < 2.0.0)
76
+
77
+ PLATFORMS
78
+ arm64-darwin-20
79
+ ruby
80
+ x86_64-linux
81
+
82
+ DEPENDENCIES
83
+ dotenv
84
+ notionrb!
85
+ rake (~> 13)
86
+ rspec
87
+ rubocop (~> 0.82.0)
88
+ rubocop-performance (~> 1.5.2)
89
+ rubocop-rspec (~> 1.39.0)
90
+ timecop
91
+ vcr
92
+ webmock
93
+
94
+ BUNDLED WITH
95
+ 2.2.16
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.