Class: NotionRubyMapping::SelectProperty

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

Overview

Select property

Constant Summary collapse

TYPE =
"select"

Instance Attribute Summary

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 EqualsDoesNotEqual

#filter_does_not_equal, #filter_equals

Methods inherited from Property

create_from_json, #make_filter_query, #type

Constructor Details

#initialize(name, json: nil, select: nil) ⇒ SelectProperty

Returns a new instance of SelectProperty.

Parameters:

  • name (String)

    Property name

  • json (Hash) (defaults to: nil)
  • select (String) (defaults to: nil)

    String value (optional)



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

def initialize(name, json: nil, select: nil)
  super(name, json: json)
  @select = select
end

Instance Method Details

#create_jsonHash

Returns:

  • (Hash)


19
20
21
# File 'lib/notion_ruby_mapping/select_property.rb', line 19

def create_json
  {"select" => @select ? {"name" => @select} : @json} || {}
end

#select=(select) ⇒ String

Returns settled value.

Parameters:

  • select (String)

Returns:

  • (String)

    settled value



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

def select=(select)
  @will_update = true
  @select = select
end