Class: NotionRubyMapping::EmailProperty

Inherits:
Property
  • Object
show all
Includes:
ContainsDoesNotContain, EqualsDoesNotEqual, IsEmptyIsNotEmpty, StartsWithEndsWith
Defined in:
lib/notion_ruby_mapping/properties/email_property.rb

Overview

EmailProperty

Constant Summary collapse

TYPE =
"email"

Instance Attribute Summary

Attributes inherited from Property

#name, #property_cache, #property_id, #will_update

Instance Method Summary collapse

Methods included from IsEmptyIsNotEmpty

#filter_is_empty, #filter_is_not_empty

Methods included from StartsWithEndsWith

#filter_ends_with, #filter_starts_with

Methods included from ContainsDoesNotContain

#filter_contains, #filter_does_not_contain

Methods included from EqualsDoesNotEqual

#filter_does_not_equal, #filter_equals

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_from_json, #update_property_schema_json

Constructor Details

#initialize(name, will_update: false, base_type: :page, json: nil, property_id: nil, property_cache: nil) ⇒ EmailProperty

Returns a new instance of EmailProperty.

Parameters:

  • name (String)

    Property name


35
36
37
38
39
# File 'lib/notion_ruby_mapping/properties/email_property.rb', line 35

def initialize(name, will_update: false, base_type: :page, json: 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 = json || {}
end

Instance Method Details

#emailString, Hash

Returns:

  • (String, Hash)

17
18
19
# File 'lib/notion_ruby_mapping/properties/email_property.rb', line 17

def email
  @json
end

#email=(email) ⇒ Object

Parameters:

  • email (String)

24
25
26
27
28
# File 'lib/notion_ruby_mapping/properties/email_property.rb', line 24

def email=(email)
  assert_page_property __method__
  @will_update = true
  @json = email
end

#property_values_jsonHash

Returns:

  • (Hash)

42
43
44
45
# File 'lib/notion_ruby_mapping/properties/email_property.rb', line 42

def property_values_json
  assert_page_property __method__
  {@name => {"email" => @json, "type" => "email"}}
end