[P] means methods for Page Property, [D] means methods for Database Property.
1. Instance methods
[P] add_person(user_id_or_uo)
- [PARAM] user_id_or_uo
- user_id (String)
- existing UserObject
add_person
of Page property adds a UserObject generated from user_id, or a parameter UserObject.
add_person
of Database property raises StandardError.
page.properties["UserTitle"].add_person "a_user_id" # => [#<NotionRubyMapping::UserObject:...>, #<NotionRubyMapping::UserObject:...>] page.properties["UserTitle"].add_person UserObject.user_object("a_user_id") # => [#<NotionRubyMapping::UserObject:...>, #<NotionRubyMapping::UserObject:...>] db.properties["UserTitle"].add_person "a_user_id" # => ...in `assert_page_property': add_person can execute only Page property. (StandardError)
filter_contains(value) → Query
- [PARAM] value value_for_filter
filter_contains
creates a Query object for contains
filter.db.properties["CreatedByTitle"].filter_contains "a_user_id" # => #<NotionRubyMapping::Query:0x0000000110525498 @filter={"property"=>"CreatedByTitle", "created_by"=>{"contains"=>"a_user_id"}}, @page_size=100, @sort=[], @start_cursor=nil> ### only RollupProperty (none, any, every) db.properties["RollupTitle"].filter_contains "abc", condition: "any", another_type: "rich_text" # => #<NotionRubyMapping::Query:0x0000000105394f30 @filter={"property"=>"RollupTitle", "any"=>{"rich_text"=>{"contains"=>"abc"}}}, @page_size=100, @sort=[], @start_cursor=nil>
filter_does_not_contain(value) → Query
- [PARAM] value value_for_filter
filter_does_not_contain
creates a Query object for does_not_contain
filter.db.properties["CreatedByTitle"].filter_does_not_contain "a_user_id" => #<NotionRubyMapping::Query:0x0000000110666b68 @filter={"property"=>"CreatedByTitle", "created_by"=>{"does_not_contain"=>"a_user_id"}}, @page_size=100, @sort=[], @start_cursor=nil> ### only RollupProperty (none, any, every) db.properties["CreatedByTitle"].filter_does_not_contain "abc", condition: "every", another_type: "people" # => #<NotionRubyMapping::Query:0x000000010533e888 @filter={"property"=>"RollupTitle", "every"=>{"people"=>{"does_not_contain"=>"abc"}}}, @page_size=100, @sort=[], @start_cursor=nil>
filter_is_empty → Query
filter_is_empty
creates a Query object for is_empty
filter.db.properties["CreatedByTitle"].filter_is_empty => #<NotionRubyMapping::Query:0x0000000106af9ef0 @filter={"property"=>"CreatedByTitle", "created_by"=>{"is_empty"=>true}}, @page_size=100, @sort=[], @start_cursor=nil>
filter_is_not_empty → Query
filter_is_not_empty
creates a Query object for is_not_empty
filter.db.properties["CreatedByTitle"].filter_is_not_empty => #<NotionRubyMapping::Query:0x00000001104b7290 @filter={"property"=>"CreatedByTitle", "created_by"=>{"is_not_empty"=>true}}, @page_size=100, @sort=[], @start_cursor=nil>
people → Array, Hash
people
of Page property returns the array of UserObject property values of the page.
people
of Database property returns an empty Hash {}.
page.properties["UserTitle"].people # => [#<NotionRubyMapping::UserObject:...>] db.properties["UserTitle"].people # => {}
[P] people=(people)
- [PARAM] people
- user_id (String)
- [user_id1, user_id2, ...] (Array of String)
- a_user_object (UserObject)
- [user_object1, user_object2, ...] (Array of UserObjects)
people=
of Page property sets an array of UserObjects generated from parameters.
people=
of Database property raises StandardError.
pp = page.properties["UserTitle"] pp.people = "a@exmaple.com" pp.people # => [#<NotionRubyMapping::UserObject:0x0000000109da70a0 @json={}, @user_id="a@example.com", @will_update=false>] pp.people = %w[a_user_id b_user_id] pp.people # => # [#<NotionRubyMapping::UserObject:0x000000010b126fb8 @json={}, @user_id="a_user_id", @will_update=false>, # #<NotionRubyMapping::UserObject:0x000000010b126f40 @json={}, @user_id="b_user_id", @will_update=false>] pp.people = UserObject.user_object "a_user_id" pp.people # => [#<NotionRubyMapping::UserObject:0x0000000109f461e0 @json={}, @user_id="a_user_id", @will_update=false>] pp.people = [UserObject.user_object("a_user_id"), UserObject.user_object("b_user_id")] pp.people # => # [#<NotionRubyMapping::UserObject:0x0000000109d879f8 @json={}, @user_id="a_user_id", @will_update=false>, # #<NotionRubyMapping::UserObject:0x0000000109d87930 @json={}, @user_id="b_user_id", @will_update=false>] db.properties["UserTitle"].people = "a_user_id" # => ...in `assert_page_property': add_person can execute only Page property. (StandardError)