Class: NotionRails::BasePage

Inherits:
Object
  • Object
show all
Includes:
Renderers
Defined in:
lib/notion_rails/base_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#archivedObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def archived
  @archived
end

#coverObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def cover
  @cover
end

#created_byObject (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_timeObject (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

#descriptionObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def description
  @description
end

#iconObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def icon
  @icon
end

#idObject (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_byObject (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_timeObject (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

#parentObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def parent
  @parent
end

#propertiesObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def properties
  @properties
end

#published_atObject (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

#slugObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def slug
  @slug
end

#tagsObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def tags
  @tags
end

#titleObject (readonly)

TODO: validate object type is page



8
9
10
# File 'lib/notion_rails/base_page.rb', line 8

def title
  @title
end

#urlObject (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(options = {})
  render_paragraph(@description, options)
end

#formatted_published_at(options = {}) ⇒ Object



53
54
55
# File 'lib/notion_rails/base_page.rb', line 53

def formatted_published_at(options = {})
  render_date(@published_at, options)
end

#formatted_title(options = {}) ⇒ Object



45
46
47
# File 'lib/notion_rails/base_page.rb', line 45

def formatted_title(options = {})
  render_title(@title, options)
end