<aside> 👉 Links (Property base class)

CheckboxProperty

DateProperty

FormulaProperty

MultiSelectProperty

PhoneNumberProperty

RollupProperty

TitleProperty

CreatedByProperty

EmailProperty

LastEditedByProperty

NumberProperty

RelationProperty 🚧

SelectProperty

UrlProperty

CreatedTimeProperty

FilesProperty

LastEditedTimeProperty

PeopleProperty

RichTextProperty

StatusProperty

Notion Ruby Mapping Public API Reference

</aside>

<aside> 💡

[P] means methods for Page Property, [DB/DS] means methods for Database or DataSource Property.

</aside>

1. Instance methods

date → Hash

  1. date of Page property returns a Hash object with start, end and time_zone keys.
  2. date of Database property returns an empty Hash {}.
page.properties["DateTitle"].date
# => {"start"=>"2022-03-14", "end"=>nil, "time_zone"=>nil}
db.properties["DateTitle"].date
# => {}

[P] end_date → String, Date, Time

  1. end_date of Page property returns the end date or end date-time property value of the page.

  2. end_date of Database property raises StandardError.

    page.properties["DateTitle"].end_date
    # => nil
    db.properties["DateTitle"].end_date
    # ...:in `assert_page_property': end_date= can execute only Page property. (StandardError)
    

[P] clear → DateProperty

  1. clear of Page property clears the date value of the page property and sets will_update_flag to true.

  2. Internally, clear is equivalent to setting start_date = nil.

  3. clear returns self.

  4. clear of Database property raises StandardError.

    page.properties["DateTitle"].clear
    # => #<NotionRubyMapping::DateProperty:...>
    
    page.save
    # Updates the page property with {"type"=>"date", "date"=>nil}
    
    db.properties["DateTitle"].clear
    # ...:in `assert_page_property': clear can execute only Page property. (StandardError)
    

[P] end_date=(value) → String, Date, Time, NilClass

  1. end_date=(value) of Page property sets the end date or end date-time property value of the page and set will_update_flag to true.

  2. end_date = nil clears only the end date. If the start date exists, the date property itself remains.

  3. end_date=(value) of Database property raises StandardError.

    page.properties["DateTitle"].end_date = Date.new(2022, 5, 5)
    # => #<Date: 2022-05-05 ((2459705j,0s,0n),+0s,2299161j)>
    
    page.properties["DateTitle"].end_date = nil
    # => nil
    # The start date is kept, and only the end date is cleared.
    
    db.properties["DateTitle"].end_date = Date.new(2022, 5, 5)
    # ...:in `assert_page_property': end_date= can execute only Page property. (StandardError)