class Slack::BlockKit::CompositionObjects::ConfirmationDialog

Attributes

confirm[R]
deny[R]
text[R]
title[R]

Public Class Methods

[](hash) click to toggle source
# File lib/slack/block_kit/composition_objects/confirmation_dialog.rb, line 10
def self.[](hash)
  new.tap do |object|
    object.title = hash.fetch(:title)
    object.text = hash.fetch(:text)
    object.confirm = hash.fetch(:confirm)
    object.deny = hash.fetch(:deny)
  end
end

Public Instance Methods

confirm=(obj) click to toggle source
# File lib/slack/block_kit/composition_objects/confirmation_dialog.rb, line 34
def confirm=(obj)
  raise TypeError, 'confirm must be a Text Object' unless obj.is_a?(Text)
  raise TypeError, 'confirm must be plain_text' unless obj.type == :plain_text
  raise RangeError, 'confirm is max 30 characters' unless obj.text.size <= 30

  @confirm = obj
end
deny=(obj) click to toggle source
# File lib/slack/block_kit/composition_objects/confirmation_dialog.rb, line 42
def deny=(obj)
  raise TypeError, 'deny must be a Text Object' unless obj.is_a?(Text)
  raise TypeError, 'deny must be plain_text' unless obj.type == :plain_text
  raise RangeError, 'deny is max 30 characters' unless obj.text.size <= 30

  @deny = obj
end
text=(obj) click to toggle source
# File lib/slack/block_kit/composition_objects/confirmation_dialog.rb, line 27
def text=(obj)
  raise TypeError, 'text must be a Text Object' unless obj.is_a?(Text)
  raise RangeError, 'text is max 300 characters' unless obj.text.size <= 300

  @text = obj
end
title=(obj) click to toggle source
# File lib/slack/block_kit/composition_objects/confirmation_dialog.rb, line 19
def title=(obj)
  raise TypeError, 'title must be a Text Object' unless obj.is_a?(Text)
  raise TypeError, 'title must be plain_text' unless obj.type == :plain_text
  raise RangeError, 'title is max 100 characters' unless obj.text.size <= 100

  @title = obj
end
to_h() click to toggle source
# File lib/slack/block_kit/composition_objects/confirmation_dialog.rb, line 50
def to_h
  { title: title.to_h,
    text: text.to_h,
    confirm: confirm.to_h,
    deny: deny.to_h }.compact
end