Module: SlackValidBlockKit::Validator::MultiSelectMenu
- Included in:
- Runner
- Defined in:
- lib/slack_valid_block_kit/validator/multi_select_menu.rb
Constant Summary collapse
- MULTI_STATIC_SELECT_PROPERTIES =
i(type placeholder action_id option_groups confirm max_selected_items focus_on_load)
- MULTI_EXTERNAL_SELECT_PROPERTIES =
i(type placeholder action_id min_query_length confirm max_selected_items focus_on_load)
- MULTI_USERS_SELECT_PROPERTIES =
i(type placeholder action_id initial_users confirm max_selected_items focus_on_load)
- MULTI_CONVERSATIONS_SELECT_PROPERTIES =
i(type placeholder action_id initial_conversations default_to_current_conversation confirm max_selected_items filter focus_on_load)
- MULTI_CHANNELS_SELECT_PROPERTIES =
i(type placeholder action_id initial_channels confirm max_selected_items focus_on_load)
Instance Method Summary collapse
- #validate_multi_channels_select(hash, path, options = nil) ⇒ Object
- #validate_multi_conversations_select(hash, path, options = nil) ⇒ Object
- #validate_multi_external_select(hash, path, options = nil) ⇒ Object
- #validate_multi_static_select(hash, path, options = nil) ⇒ Object
- #validate_multi_users_select(hash, path, options = nil) ⇒ Object
Instance Method Details
#validate_multi_channels_select(hash, path, options = nil) ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/slack_valid_block_kit/validator/multi_select_menu.rb', line 64 def validate_multi_channels_select(hash, path, = nil) validate_for_properties(hash, path, MULTI_CHANNELS_SELECT_PROPERTIES) validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_channels_select"]) validate_for(hash[:initial_channels], "#{path}.initial_channels", :array_of_string, false) validate_common_for_multi_select(hash, path, ) end |
#validate_multi_conversations_select(hash, path, options = nil) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/slack_valid_block_kit/validator/multi_select_menu.rb', line 53 def validate_multi_conversations_select(hash, path, = nil) validate_for_properties(hash, path, MULTI_CONVERSATIONS_SELECT_PROPERTIES) validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_conversations_select"]) validate_for(hash[:initial_conversations], "#{path}.initial_conversations", :array_of_string, false) validate_for(hash[:default_to_current_conversation], "#{path}.default_to_current_conversation", :bool, false) validate_filter(hash["filter"], "#{path}.filter") unless hash["filter"].nil? validate_common_for_multi_select(hash, path, ) end |
#validate_multi_external_select(hash, path, options = nil) ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/slack_valid_block_kit/validator/multi_select_menu.rb', line 34 def validate_multi_external_select(hash, path, = nil) validate_for_properties(hash, path, MULTI_EXTERNAL_SELECT_PROPERTIES) validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_external_select"]) validate_for(hash[:min_query_length], "#{path}.min_query_length", Integer, false) validate_for(hash[:initial_options], "#{path}.initial_options", Array, false) validate_common_for_multi_select(hash, path, ) end |
#validate_multi_static_select(hash, path, options = nil) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/slack_valid_block_kit/validator/multi_select_menu.rb', line 9 def validate_multi_static_select(hash, path, = nil) validate_for_properties(hash, path, MULTI_STATIC_SELECT_PROPERTIES) validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_static_select"]) validate_for(hash[:options], "#{path}.options", Array, false, max: 100) = Array(hash[:options]) .each_with_index do |e, i| validate_option(e, "#{path}.options[#{i}]", { text_type: :text_objects }) end validate_for(hash[:option_groups], "#{path}.option_groups", Array, false, max: 100) option_groups = Array(hash[:option_groups]) option_groups.each_with_index do |e, i| validate_option_group(e, "#{path}.option_groups[#{i}]") end if hash[:options].nil? && hash[:option_groups].nil? add_error(path, :require_options_or_option_groups) end validate_for_initial_option_of_multi_static_select(hash[:initial_options], "#{path}.initial_options", options: , option_groups: option_groups) validate_common_for_multi_select(hash, path, ) end |
#validate_multi_users_select(hash, path, options = nil) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/slack_valid_block_kit/validator/multi_select_menu.rb', line 44 def validate_multi_users_select(hash, path, = nil) validate_for_properties(hash, path, MULTI_USERS_SELECT_PROPERTIES) validate_for(hash[:type], "#{path}.type", String, true, only: ["multi_users_select"]) validate_for(hash[:initial_users], "#{path}.initial_users", :array_of_string, false) validate_common_for_multi_select(hash, path, ) end |