Class: Notion::Objects::Page
- Inherits:
-
Base
- Object
- Base
- Notion::Objects::Page
show all
- Defined in:
- lib/notion/objects/types.rb
Instance Attribute Summary
Attributes inherited from Base
#raw
Instance Method Summary
collapse
Methods inherited from Base
#deconstruct_keys, #in_trash?, #initialize, #inspect, #method_missing, #respond_to_missing?
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Notion::Objects::Base
Instance Method Details
#[](key) ⇒ Object
6
7
8
9
|
# File 'lib/notion/objects/types.rb', line 6
def [](key)
property = raw.fetch("properties", {})[key.to_s]
property ? PropertyValue.build(property) : super
end
|
#icon ⇒ Object
17
|
# File 'lib/notion/objects/types.rb', line 17
def icon = raw["icon"] && Icon.new(raw["icon"])
|
#parent ⇒ Object
16
|
# File 'lib/notion/objects/types.rb', line 16
def parent = Parent.new(raw.fetch("parent", {}))
|
#title ⇒ Object
11
12
13
14
|
# File 'lib/notion/objects/types.rb', line 11
def title
title_property = raw.fetch("properties", {}).values.find { |property| property["type"] == "title" }
title_property && PropertyValue.build(title_property).to_s
end
|