Class: NotionRubyMapping::NumberProperty

Inherits:
Property
  • Object
show all
Includes:
EqualsDoesNotEqual, GreaterThanLessThan, IsEmptyIsNotEmpty
Defined in:
lib/notion_ruby_mapping/number_property.rb

Overview

Number property

Constant Summary collapse

TYPE =
"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 GreaterThanLessThan

#filter_greater_than, #filter_greater_than_or_equal_to, #filter_less_than, #filter_less_than_or_equal_to

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, number: nil) ⇒ NumberProperty

Returns a new instance of NumberProperty.

Parameters:

  • name (String)

    Property name

  • number (Float, Integer) (defaults to: nil)

    Number value (optional)



13
14
15
16
# File 'lib/notion_ruby_mapping/number_property.rb', line 13

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

Instance Attribute Details

#numberObject

Returns the value of attribute number.



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

def number
  @number
end

Instance Method Details

#property_values_jsonHash

Returns:

  • (Hash)


26
27
28
# File 'lib/notion_ruby_mapping/number_property.rb', line 26

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

#update_from_json(json) ⇒ Object

Parameters:

  • json (Hash)


20
21
22
23
# File 'lib/notion_ruby_mapping/number_property.rb', line 20

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