Class: NotionRubyMapping::PhoneNumberProperty

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

Overview

PhoneNumberProperty

Constant Summary collapse

TYPE =
"phone_number"

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 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

create_from_json, #make_filter_query, #type

Constructor Details

#initialize(name, will_update: false, phone_number: nil) ⇒ PhoneNumberProperty

Returns a new instance of PhoneNumberProperty.

Parameters:

  • name (String)

    Property name

  • phone_number (String) (defaults to: nil)

    phone_number value (optional)



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

def initialize(name, will_update: false, phone_number: nil)
  super name, will_update: will_update
  @phone_number = phone_number
end

Instance Attribute Details

#phone_numberObject

Returns the value of attribute phone_number.



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

def phone_number
  @phone_number
end

Instance Method Details

#property_values_jsonHash

Returns:

  • (Hash)


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

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

#update_from_json(json) ⇒ Object

Parameters:

  • json (Hash)


21
22
23
24
# File 'lib/notion_ruby_mapping/phone_number_property.rb', line 21

def update_from_json(json)
  @will_update = false
  @phone_number = json["phone_number"]
end