Class: NotionRails::BasePage
- Inherits:
-
Object
- Object
- NotionRails::BasePage
- Includes:
- Renderers
- Defined in:
- lib/notion_rails/base_page.rb
Instance Attribute Summary collapse
-
#archived ⇒ Object
readonly
TODO: validate object type is page.
-
#cover ⇒ Object
readonly
TODO: validate object type is page.
-
#created_by ⇒ Object
readonly
TODO: validate object type is page.
-
#created_time ⇒ Object
readonly
TODO: validate object type is page.
-
#description ⇒ Object
readonly
TODO: validate object type is page.
-
#icon ⇒ Object
readonly
TODO: validate object type is page.
-
#id ⇒ Object
readonly
TODO: validate object type is page.
-
#last_edited_by ⇒ Object
readonly
TODO: validate object type is page.
-
#last_edited_time ⇒ Object
readonly
TODO: validate object type is page.
-
#parent ⇒ Object
readonly
TODO: validate object type is page.
-
#properties ⇒ Object
readonly
TODO: validate object type is page.
-
#published_at ⇒ Object
readonly
TODO: validate object type is page.
-
#slug ⇒ Object
readonly
TODO: validate object type is page.
-
#tags ⇒ Object
readonly
TODO: validate object type is page.
-
#title ⇒ Object
readonly
TODO: validate object type is page.
-
#url ⇒ Object
readonly
TODO: validate object type is page.
Instance Method Summary collapse
- #formatted_description(options = {}) ⇒ Object
- #formatted_published_at(options = {}) ⇒ Object
- #formatted_title(options = {}) ⇒ Object
-
#initialize(data) ⇒ BasePage
constructor
A new instance of BasePage.
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_list_items, #render_numbered_list_item, #render_paragraph, #render_quote, #render_title, #render_video, #text_renderer
Constructor Details
#initialize(data) ⇒ BasePage
Returns a new instance of BasePage.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/notion_rails/base_page.rb', line 25 def initialize(data) @id = data['id'] @created_time = data['created_time'] @last_edited_time = data['last_edited_time'] # TODO: handle user object @created_by = data['created_by'] @last_edited_by = data['last_edited_by'] # TODO: handle external type @cover = data['cover'] # TODO: handle emoji type @icon = data['icon'] # TODO: handle database_id type @parent = data['parent'] @archived = data['archived'] # TODO: handle properties object @properties = data['properties'] process_properties @url = data['url'] end |
Instance Attribute Details
#archived ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def archived @archived end |
#cover ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def cover @cover end |
#created_by ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def created_by @created_by end |
#created_time ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def created_time @created_time end |
#description ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def description @description end |
#icon ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def icon @icon end |
#id ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def id @id end |
#last_edited_by ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def last_edited_by @last_edited_by end |
#last_edited_time ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def last_edited_time @last_edited_time end |
#parent ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def parent @parent end |
#properties ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def properties @properties end |
#published_at ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def published_at @published_at end |
#slug ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def slug @slug end |
#tags ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def @tags end |
#title ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def title @title end |
#url ⇒ Object (readonly)
TODO: validate object type is page
8 9 10 |
# File 'lib/notion_rails/base_page.rb', line 8 def url @url end |
Instance Method Details
#formatted_description(options = {}) ⇒ Object
49 50 51 |
# File 'lib/notion_rails/base_page.rb', line 49 def formatted_description( = {}) render_paragraph(@description, ) end |
#formatted_published_at(options = {}) ⇒ Object
53 54 55 |
# File 'lib/notion_rails/base_page.rb', line 53 def formatted_published_at( = {}) render_date(@published_at, ) end |
#formatted_title(options = {}) ⇒ Object
45 46 47 |
# File 'lib/notion_rails/base_page.rb', line 45 def formatted_title( = {}) render_title(@title, ) end |