Class: NotionRubyMapping::CheckboxProperty

Inherits:
Property
  • Object
show all
Includes:
EqualsDoesNotEqual
Defined in:
lib/notion_ruby_mapping/checkbox_property.rb

Overview

Checkbox property

Constant Summary collapse

TYPE =
"checkbox"

Instance Attribute Summary collapse

Attributes inherited from Property

#name, #will_update

Instance Method Summary collapse

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, checkbox: false) ⇒ CheckboxProperty

Returns a new instance of CheckboxProperty.

Parameters:

  • name (String)

    Property name

  • checkbox (Boolean) (defaults to: false)

    Number value (optional)



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

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

Instance Attribute Details

#checkboxObject

Returns the value of attribute checkbox.



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

def checkbox
  @checkbox
end

Instance Method Details

#property_values_jsonHash

Returns:

  • (Hash)


31
32
33
# File 'lib/notion_ruby_mapping/checkbox_property.rb', line 31

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

#update_from_json(json) ⇒ Object

Parameters:

  • json (Hash)


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

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