Class: NotionRubyMapping::PhoneNumberProperty

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

Overview

PhoneNumberProperty

Constant Summary collapse

TYPE =
"phone_number"

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) ⇒ PhoneNumberProperty

Returns a new instance of PhoneNumberProperty.

Parameters:

  • name (String, Symbol)

    Property name



37
38
39
40
41
# File 'lib/notion_ruby_mapping/properties/phone_number_property.rb', line 37

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 = database? ? {} : json
end

Instance Method Details

#phone_numberString, ...

Returns phone number (Page), {} (Database).

Returns:

  • (String, Hash, nil)

    phone number (Page), {} (Database)

See Also:



18
19
20
# File 'lib/notion_ruby_mapping/properties/phone_number_property.rb', line 18

def phone_number
  @json
end

#phone_number=(phone_number) ⇒ Object



26
27
28
29
30
# File 'lib/notion_ruby_mapping/properties/phone_number_property.rb', line 26

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

#property_values_jsonHash

Page property only methods

Returns:

  • (Hash)


45
46
47
48
# File 'lib/notion_ruby_mapping/properties/phone_number_property.rb', line 45

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