Class: NotionRubyMapping::ButtonProperty

Inherits:
Property
  • Object
show all
Defined in:
lib/notion_ruby_mapping/properties/button_property.rb

Overview

Button property

Constant Summary collapse

TYPE =
"button"

Instance Attribute Summary

Attributes inherited from Property

#name, #property_cache, #property_id, #will_update

Instance Method Summary collapse

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", property_id: nil, property_cache: nil, json: nil) ⇒ ButtonProperty

Returns a new instance of ButtonProperty.

Parameters:

  • name (String, Symbol)

    Property name

  • json (Boolean, Hash) (defaults to: nil)


19
20
21
22
23
# File 'lib/notion_ruby_mapping/properties/button_property.rb', line 19

def initialize(name, will_update: false, base_type: "page", property_id: nil, property_cache: nil, json: 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

#buttonBoolean, ...

Returns:

  • (Boolean, Hash, nil)


13
14
15
# File 'lib/notion_ruby_mapping/properties/button_property.rb', line 13

def button
  @json
end

#property_values_jsonHash

Returns:

  • (Hash)


28
29
30
31
# File 'lib/notion_ruby_mapping/properties/button_property.rb', line 28

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