<aside> 👉 Links (Property base class)

Property

ButtonProperty

CreatedTimeProperty

FilesProperty

LastEditedTimeProperty

PeopleProperty

RichTextProperty

StatusProperty

UrlProperty

CheckboxProperty

DateProperty

FormulaProperty

MultiSelectProperty

PhoneNumberProperty

RollupProperty

TitleProperty

VerificationProperty

CreatedByProperty

EmailProperty

LastEditedByProperty

NumberProperty

RelationProperty

SelectProperty

UniqueIdProperty

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

UniqueIdProperty handles the Notion unique_id property. Page values are read-only. The auto-incremented number is assigned by Notion. Database / DataSource schema can set prefix.

[P/DB/DS] unique_id → Hash, nil

  1. unique_id of Page property returns the unique ID Hash, including prefix and number.

  2. unique_id of Database or DataSource property returns the schema Hash. When prefix is not set, it is an empty Hash {} or a Hash whose prefix is nil.

  3. Page unique ID values cannot be updated. Page#save does not send this property unless will_update is true, and UniqueIdProperty has no Page setter that sets will_update.

    page.properties["ID"].unique_id
    # => {"prefix"=>"ST", "number"=>3}
    
    ds.properties["ID"].unique_id
    # => {}
    

[P/DB/DS] prefix → String, nil

  1. prefix reads @json["prefix"].

  2. Page property returns the prefix of the unique ID, or nil when it is not set.

  3. Database / DataSource property returns the schema prefix, or nil when it is not set.

    page.properties["ID"].prefix
    # => "ST"
    
    ds.properties["ID"].prefix
    # => nil
    

[P/DB/DS] number → Integer, nil

  1. number reads @json["number"].

  2. Page property returns the auto-incremented number assigned by Notion.

  3. Database / DataSource schema has no number, so this usually returns nil.

  4. number cannot be set. Notion assigns it automatically.

    page.properties["ID"].number
    # => 3
    
    ds.properties["ID"].number
    # => nil
    

[DB/DS] prefix=(value) → String, nil

  1. prefix= of Database / DataSource property sets the schema prefix and sets will_update to true.