Class: Notion::Api::PagesMethods

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

Instance Method Summary collapse

Instance Method Details

#create(body) ⇒ Notion::Page

Creates a new page in the specified database or as a child of an existing page. developers.notion.com/reference/post-page

Parameters:

  • body (Hash)

Returns:



20
21
22
23
# File 'lib/notion-sdk-ruby/api/pages.rb', line 20

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

#retrieve(id) ⇒ Notion::Page

Retrieves a Page object using the ID specified. developers.notion.com/reference/retrieve-a-page

Parameters:

  • id (String)

    page_id

Returns:



10
11
12
13
# File 'lib/notion-sdk-ruby/api/pages.rb', line 10

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

#update(id, body) ⇒ Notion::Page

Updates page property values for the specified page. developers.notion.com/reference/patch-page

Parameters:

  • id (String)

    page_id

  • body (Hash)

Returns:



30
31
32
33
# File 'lib/notion-sdk-ruby/api/pages.rb', line 30

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