Module: Notion::Api::Endpoints::Pages
- Included in:
- Notion::Api::Endpoints
- Defined in:
- lib/notion/api/endpoints/pages.rb
Instance Method Summary collapse
-
#create_page(options = {}) ⇒ Object
Creates a new page in the specified database.
-
#page(options = {}) ⇒ Object
Retrieves a 📄Page object using the ID specified in the request path.
-
#update_page(options = {}) ⇒ Object
Updates a page by setting the values of any properties specified in the JSON body of the request.
Instance Method Details
#create_page(options = {}) ⇒ Object
Creates a new page in the specified database. Later iterations of the API will support creating pages outside databases. Note that this iteration of the API will only expose page properties, not page content, as described in the data model.
37 38 39 40 |
# File 'lib/notion/api/endpoints/pages.rb', line 37 def create_page( = {}) throw ArgumentError.new('Required arguments :parent.database_id missing') if .dig(:parent, :database_id).nil? post("pages", ) end |
#page(options = {}) ⇒ Object
Retrieves a 📄Page object using the ID specified in the request path. Note that this version of the API only exposes page properties, not page content
17 18 19 20 |
# File 'lib/notion/api/endpoints/pages.rb', line 17 def page( = {}) throw ArgumentError.new('Required arguments :id missing') if [:id].nil? get("pages/#{[:id]}?archived=#{[:archived]}") end |
#update_page(options = {}) ⇒ Object
Updates a page by setting the values of any properties specified in the JSON body of the request. Properties that are not set via parameters will remain unchanged.
Note that this iteration of the API will only expose page properties, not page content, as described in the data model.
59 60 61 62 |
# File 'lib/notion/api/endpoints/pages.rb', line 59 def update_page( = {}) throw ArgumentError.new('Required arguments :id missing') if [:id].nil? patch("pages/#{[:id]}", ) end |