Class: Notion::Databases

Inherits:
Object
  • Object
show all
Includes:
RequestClient
Defined in:
lib/notion-sdk-ruby/resources/databases.rb

Instance Method Summary collapse

Methods included from RequestClient

#delete, #get, #patch, #post

Instance Method Details

#create(body) ⇒ Object


22
23
24
25
# File 'lib/notion-sdk-ruby/resources/databases.rb', line 22

def create(body)
  response = post("/v1/databases", body.to_json)
  Database.new(response.body)
end

#listObject

DEPRECATED


11
12
13
14
15
# File 'lib/notion-sdk-ruby/resources/databases.rb', line 11

def list
  warn "DEPRECATED: client.databases.list is deprecated."
  response = get("/v1/databases")
  List.new(response.body)
end

#query(id, body) ⇒ Object


17
18
19
20
# File 'lib/notion-sdk-ruby/resources/databases.rb', line 17

def query(id, body)
  response = post("/v1/databases/#{id}/query", body.to_json)
  List.new(response.body)
end

#retrieve(id) ⇒ Object


5
6
7
8
# File 'lib/notion-sdk-ruby/resources/databases.rb', line 5

def retrieve(id)
  response = get("/v1/databases/#{id}")
  Database.new(response.body)
end

#update(id, body) ⇒ Object


27
28
29
30
# File 'lib/notion-sdk-ruby/resources/databases.rb', line 27

def update(id, body)
  response = patch("/v1/databases/#{id}", body.to_json)
  Database.new(response.body)
end