Sha256: b161aedb77516a8962a3b0bc13d57f710bce77c34bfa8d3c04cac410e40db899

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 KB

Contents

module Notion
  module Api
    class PagesMethods
      include RequestClient

      # Retrieves a Page object using the ID specified.
      # https://developers.notion.com/reference/retrieve-a-page
      # @param [String] id page_id
      # @return [Notion::Page]
      def retrieve(id)
        response = get("/v1/pages/#{id}")
        Page.new(response.body)
      end

      # Creates a new page in the specified database or as a child of
      # an existing page.
      # https://developers.notion.com/reference/post-page
      # @param [Hash] body
      # @return [Notion::Page]
      def create(body)
        response = post("/v1/pages", body.to_json)
        Page.new(response.body)
      end

      # Updates page property values for the specified page.
      # https://developers.notion.com/reference/patch-page
      # @param [String] id page_id
      # @param [Hash] body
      # @return [Notion::Page]
      def update(id, body)
        response = patch("/v1/pages/#{id}", body.to_json)
        Page.new(response.body)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
notion-sdk-ruby-0.6.1 lib/notion-sdk-ruby/api/pages.rb
notion-sdk-ruby-0.6.0 lib/notion-sdk-ruby/api/pages.rb