Class: NotionToHtml::BasePage
- Inherits:
-
Object
- Object
- NotionToHtml::BasePage
- Includes:
- Renderers
- Defined in:
- lib/notion_to_html/base_page.rb
Constant Summary
Constants included from Renderers
Renderers::DEFAULT_CSS_CLASSES
Instance Attribute Summary collapse
-
#archived ⇒ Boolean
readonly
Whether the page is archived.
-
#cover ⇒ Hash?
readonly
The cover image of the page.
-
#created_by ⇒ String
readonly
The user who created the page.
-
#created_time ⇒ String
readonly
The creation timestamp of the page.
-
#description ⇒ Array<Hash>?
readonly
The description of the page.
-
#icon ⇒ Hash?
readonly
The icon of the page.
-
#id ⇒ String
readonly
The ID of the page.
-
#last_edited_by ⇒ String
readonly
The user who last edited the page.
-
#last_edited_time ⇒ String
readonly
The last edited timestamp of the page.
-
#parent ⇒ Hash
readonly
The parent of the page (e.g., database ID).
-
#properties ⇒ Hash
readonly
The properties of the page.
-
#published_at ⇒ String?
readonly
The publication date of the page.
-
#slug ⇒ String?
readonly
The slug of the page.
-
#tags ⇒ Array<Hash>?
readonly
The tags associated with the page.
-
#title ⇒ Array<Hash>?
readonly
The title of the page.
-
#url ⇒ String
readonly
The URL of the page.
Instance Method Summary collapse
-
#formatted_description(options = {}) ⇒ String
Renders the formatted description of the page.
-
#formatted_published_at(options = {}) ⇒ String
Renders the formatted publication date of the page.
-
#formatted_title(options = {}) ⇒ String
Renders the formatted title of the page.
-
#initialize(data) ⇒ BasePage
constructor
Initializes a new BasePage object.
Methods included from Renderers
#annotation_to_css_class, #render_bulleted_list_item, #render_callout, #render_code, #render_date, #render_heading_1, #render_heading_2, #render_heading_3, #render_image, #render_numbered_list_item, #render_paragraph, #render_quote, #render_table_of_contents, #render_video, #text_renderer
Constructor Details
#initialize(data) ⇒ BasePage
Initializes a new BasePage object.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/notion_to_html/base_page.rb', line 47 def initialize(data) @id = data['id'] @created_time = data['created_time'] @last_edited_time = data['last_edited_time'] @created_by = data['created_by'] # TODO: handle user object @last_edited_by = data['last_edited_by'] # TODO: handle user object @cover = data['cover'] # TODO: handle external type @icon = data['icon'] # TODO: handle emoji type @parent = data['parent'] # TODO: handle database_id type @archived = data['archived'] @properties = data['properties'] # TODO: handle properties object process_properties @url = data['url'] end |
Instance Attribute Details
#archived ⇒ Boolean (readonly)
Returns whether the page is archived.
29 30 31 |
# File 'lib/notion_to_html/base_page.rb', line 29 def archived @archived end |
#cover ⇒ Hash? (readonly)
Returns the cover image of the page.
23 24 25 |
# File 'lib/notion_to_html/base_page.rb', line 23 def cover @cover end |
#created_by ⇒ String (readonly)
Returns the user who created the page.
19 20 21 |
# File 'lib/notion_to_html/base_page.rb', line 19 def created_by @created_by end |
#created_time ⇒ String (readonly)
Returns the creation timestamp of the page.
15 16 17 |
# File 'lib/notion_to_html/base_page.rb', line 15 def created_time @created_time end |
#description ⇒ Array<Hash>? (readonly)
Returns the description of the page.
41 42 43 |
# File 'lib/notion_to_html/base_page.rb', line 41 def description @description end |
#icon ⇒ Hash? (readonly)
Returns the icon of the page.
25 26 27 |
# File 'lib/notion_to_html/base_page.rb', line 25 def icon @icon end |
#id ⇒ String (readonly)
Returns the ID of the page.
13 14 15 |
# File 'lib/notion_to_html/base_page.rb', line 13 def id @id end |
#last_edited_by ⇒ String (readonly)
Returns the user who last edited the page.
21 22 23 |
# File 'lib/notion_to_html/base_page.rb', line 21 def last_edited_by @last_edited_by end |
#last_edited_time ⇒ String (readonly)
Returns the last edited timestamp of the page.
17 18 19 |
# File 'lib/notion_to_html/base_page.rb', line 17 def last_edited_time @last_edited_time end |
#parent ⇒ Hash (readonly)
Returns the parent of the page (e.g., database ID).
27 28 29 |
# File 'lib/notion_to_html/base_page.rb', line 27 def parent @parent end |
#properties ⇒ Hash (readonly)
Returns the properties of the page.
31 32 33 |
# File 'lib/notion_to_html/base_page.rb', line 31 def properties @properties end |
#published_at ⇒ String? (readonly)
Returns the publication date of the page.
33 34 35 |
# File 'lib/notion_to_html/base_page.rb', line 33 def published_at @published_at end |
#slug ⇒ String? (readonly)
Returns the slug of the page.
39 40 41 |
# File 'lib/notion_to_html/base_page.rb', line 39 def slug @slug end |
#tags ⇒ Array<Hash>? (readonly)
Returns the tags associated with the page.
35 36 37 |
# File 'lib/notion_to_html/base_page.rb', line 35 def @tags end |
#title ⇒ Array<Hash>? (readonly)
Returns the title of the page.
37 38 39 |
# File 'lib/notion_to_html/base_page.rb', line 37 def title @title end |
#url ⇒ String (readonly)
Returns the URL of the page.
43 44 45 |
# File 'lib/notion_to_html/base_page.rb', line 43 def url @url end |
Instance Method Details
#formatted_description(options = {}) ⇒ String
Renders the formatted description of the page.
72 73 74 |
# File 'lib/notion_to_html/base_page.rb', line 72 def formatted_description( = {}) render_paragraph(@description, ) end |
#formatted_published_at(options = {}) ⇒ String
Renders the formatted publication date of the page.
79 80 81 |
# File 'lib/notion_to_html/base_page.rb', line 79 def formatted_published_at( = {}) render_date(@published_at, ) end |
#formatted_title(options = {}) ⇒ String
Renders the formatted title of the page.
65 66 67 |
# File 'lib/notion_to_html/base_page.rb', line 65 def formatted_title( = {}) render_heading_1(@title, ) end |