Class: NotionRubyMapping::CreatedByProperty

Inherits:
MultiProperty show all
Defined in:
lib/notion_ruby_mapping/created_by_property.rb

Overview

CreatedByProperty

Constant Summary collapse

TYPE =
"created_by"

Instance Attribute Summary collapse

Attributes inherited from Property

#name, #will_update

Instance Method Summary collapse

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

create_from_json, #make_filter_query, #type

Constructor Details

#initialize(name, json: nil, user_id: nil) ⇒ CreatedByProperty

Returns a new instance of CreatedByProperty.

Parameters:

  • name (String)

    Property name

  • user_id (String) (defaults to: nil)

    user_id (optional)

  • json (Hash) (defaults to: nil)

    json (optional)



11
12
13
14
# File 'lib/notion_ruby_mapping/created_by_property.rb', line 11

def initialize(name, json: nil, user_id: nil)
  super name, will_update: false
  @user = UserObject.new user_id: user_id, json: json
end

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



15
16
17
# File 'lib/notion_ruby_mapping/created_by_property.rb', line 15

def user
  @user
end

Instance Method Details

#property_values_jsonHash

Returns {} created_time cannot be updated.

Returns:

  • (Hash)

    {} created_time cannot be updated



24
25
26
# File 'lib/notion_ruby_mapping/created_by_property.rb', line 24

def property_values_json
  {}
end

#update_from_json(json) ⇒ Object

Parameters:

  • json (Hash)


18
19
20
21
# File 'lib/notion_ruby_mapping/created_by_property.rb', line 18

def update_from_json(json)
  @will_update = false
  @user = UserObject.new json: json["created_by"]
end