Class: Notion::Api::DatabasesMethods
- Inherits:
-
Object
- Object
- Notion::Api::DatabasesMethods
- Includes:
- RequestClient
- Defined in:
- lib/notion-sdk-ruby/api/databases.rb
Instance Method Summary collapse
-
#create(body) ⇒ Notion::Database
Creates a database as a subpage in the specified parent page, with the specified properties schema.
-
#query(id, body) ⇒ Notion::List<Notion::Page>
Gets a list of Pages contained in the database, filtered and ordered according to the filter conditions and sort criteria provided in the request.
-
#retrieve(id) ⇒ Notion::Database
Retrieves a Database object using the ID specified.
-
#update(id, body) ⇒ Notion::Database
Updates an existing database as specified by the parameters.
Instance Method Details
#create(body) ⇒ Notion::Database
Creates a database as a subpage in the specified parent page, with the specified properties schema. developers.notion.com/reference/create-a-database
31 32 33 34 |
# File 'lib/notion-sdk-ruby/api/databases.rb', line 31 def create(body) response = post("/v1/databases", body.to_json) Database.new(response.body) end |
#query(id, body) ⇒ Notion::List<Notion::Page>
Gets a list of Pages contained in the database, filtered and ordered according to the filter conditions and sort criteria provided in the request. developers.notion.com/reference/post-database-query
21 22 23 24 |
# File 'lib/notion-sdk-ruby/api/databases.rb', line 21 def query(id, body) response = post("/v1/databases/#{id}/query", body.to_json) List.new(response.body) end |
#retrieve(id) ⇒ Notion::Database
Retrieves a Database object using the ID specified. developers.notion.com/reference/retrieve-a-database
10 11 12 13 |
# File 'lib/notion-sdk-ruby/api/databases.rb', line 10 def retrieve(id) response = get("/v1/databases/#{id}") Database.new(response.body) end |
#update(id, body) ⇒ Notion::Database
Updates an existing database as specified by the parameters. developers.notion.com/reference/update-a-database
41 42 43 44 |
# File 'lib/notion-sdk-ruby/api/databases.rb', line 41 def update(id, body) response = patch("/v1/databases/#{id}", body.to_json) Database.new(response.body) end |