Class: NotionRubyMapping::CreatedByProperty
- Inherits:
-
MultiProperty
- Object
- Property
- MultiProperty
- NotionRubyMapping::CreatedByProperty
- Defined in:
- lib/notion_ruby_mapping/properties/created_by_property.rb
Overview
CreatedByProperty
Constant Summary collapse
- TYPE =
"created_by"
Instance Attribute Summary
Attributes inherited from Property
#name, #property_cache, #property_id, #will_update
Instance Method Summary collapse
- #created_by ⇒ NotionRubyMapping::UserObject, Hash
-
#initialize(name, will_update: false, base_type: "page", json: nil, user_id: nil, property_id: nil, property_cache: nil) ⇒ CreatedByProperty
constructor
A new instance of CreatedByProperty.
-
#property_values_json ⇒ Hash
Page property only methods.
- #update_from_json(json) ⇒ Object
Methods included from IsEmptyIsNotEmpty
#filter_is_empty, #filter_is_not_empty
Methods included from ContainsDoesNotContain
#filter_contains, #filter_does_not_contain
Methods inherited from Property
#assert_database_property, #assert_page_property, #clear_will_update, #contents?, create_from_json, #database?, #make_filter_query, #new_name=, #page?, #property_schema_json, #remove, #retrieve_page_property, #type, #update_property_schema_json
Constructor Details
#initialize(name, will_update: false, base_type: "page", json: nil, user_id: nil, property_id: nil, property_cache: nil) ⇒ CreatedByProperty
Returns a new instance of CreatedByProperty.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/notion_ruby_mapping/properties/created_by_property.rb', line 25 def initialize(name, will_update: false, base_type: "page", json: nil, user_id: nil, property_id: nil, property_cache: nil) super name, will_update: will_update, base_type: base_type, property_id: property_id, property_cache: property_cache @json = if database? json || {} else UserObject.new user_id: user_id, json: json end end |
Instance Method Details
#created_by ⇒ NotionRubyMapping::UserObject, Hash
14 15 16 |
# File 'lib/notion_ruby_mapping/properties/created_by_property.rb', line 14 def created_by @json end |
#property_values_json ⇒ Hash
Page property only methods
45 46 47 48 |
# File 'lib/notion_ruby_mapping/properties/created_by_property.rb', line 45 def property_values_json assert_page_property __method__ {} end |
#update_from_json(json) ⇒ Object
37 38 39 40 41 |
# File 'lib/notion_ruby_mapping/properties/created_by_property.rb', line 37 def update_from_json(json) @will_update = false cb = json["created_by"] @json = database? ? cb : UserObject.new(json: cb) end |