Class: NotionRubyMapping::Page

Inherits:
Base
  • Object
show all
Defined in:
lib/notion_ruby_mapping/page.rb

Overview

Notion page object

Instance Attribute Summary

Attributes inherited from Base

#id, #json

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #assign_property, #children, create_from_json, #created_time, #database?, dry_run_script, #icon, #initialize, #json_properties, #last_edited_time, #new_record?, #page?, #properties, #property_values_json, #reload, #restore_from_json, #save, #set_icon, #title, #update_json

Constructor Details

This class inherits a constructor from NotionRubyMapping::Base

Class Method Details

.find(id, dry_run: false) ⇒ NotionRubyMapping::Page, String

Parameters:

  • id (String)

Returns:



10
11
12
13
14
15
16
17
# File 'lib/notion_ruby_mapping/page.rb', line 10

def self.find(id, dry_run: false)
  nc = NotionCache.instance
  if dry_run
    Base.dry_run_script :get, nc.page_path(id)
  else
    nc.page id
  end
end

Instance Method Details

#create_child_database(title, *assign) ⇒ Object



19
20
21
22
# File 'lib/notion_ruby_mapping/page.rb', line 19

def create_child_database(title, *assign)
  Database.new json: {"title" => [TextObject.new(title).property_values_json]},
               assign: assign, parent: {"type" => "page_id", "page_id" => @id}
end