Class: NotionRubyMapping::MultiSelectProperty
- Inherits:
-
MultiProperty
- Object
- Property
- MultiProperty
- NotionRubyMapping::MultiSelectProperty
- Defined in:
- lib/notion_ruby_mapping/multi_select_property.rb
Overview
MultiSelect property
Constant Summary collapse
- TYPE =
"multi_select"
Instance Attribute Summary
Attributes inherited from Property
Instance Method Summary collapse
-
#create_json ⇒ Hash
Created json.
-
#initialize(name, json: nil, multi_select: nil) ⇒ MultiSelectProperty
constructor
A new instance of MultiSelectProperty.
-
#multi_select=(multi_select) ⇒ Array?
Settled array.
Methods included from IsEmptyIsNotEmpty
#filter_is_empty, #filter_is_not_empty
Methods included from ContainsDoesNotContain
#filter_contains, #filter_does_not_contain
Methods inherited from Property
create_from_json, #make_filter_query, #type
Constructor Details
#initialize(name, json: nil, multi_select: nil) ⇒ MultiSelectProperty
Returns a new instance of MultiSelectProperty.
11 12 13 14 |
# File 'lib/notion_ruby_mapping/multi_select_property.rb', line 11 def initialize(name, json: nil, multi_select: nil) super(name, json: json) @multi_select = multi_select ? Array(multi_select) : nil end |
Instance Method Details
#create_json ⇒ Hash
Returns created json.
17 18 19 |
# File 'lib/notion_ruby_mapping/multi_select_property.rb', line 17 def create_json {"multi_select" => @multi_select ? (@multi_select.map { |v| {"name" => v} }) : @json} || {} end |
#multi_select=(multi_select) ⇒ Array?
Returns settled array.
23 24 25 26 |
# File 'lib/notion_ruby_mapping/multi_select_property.rb', line 23 def multi_select=(multi_select) @will_update = true @multi_select = multi_select ? Array(multi_select) : nil end |