Class: Slack::BlockKit::Element::Timepicker

Inherits:
Object
  • Object
show all
Includes:
Composition::ConfirmationDialog::Confirmable
Defined in:
lib/slack/block_kit/element/timepicker.rb

Overview

An element which allows selection of a time of day.

On desktop clients, this time picker will take the form of a dropdown list with free-text entry for precise choices. On mobile clients, the time picker will use native time picker UIs.

api.slack.com/reference/block-kit/block-elements#timepicker

Constant Summary collapse

TYPE =
'timepicker'

Instance Method Summary collapse

Methods included from Composition::ConfirmationDialog::Confirmable

#confirmation_dialog, included

Constructor Details

#initialize(action_id:, placeholder: nil, initial: nil, emoji: nil, focus_on_load: nil) {|_self| ... } ⇒ Timepicker

Returns a new instance of Timepicker.

Yields:

  • (_self)

Yield Parameters:



18
19
20
21
22
23
24
25
# File 'lib/slack/block_kit/element/timepicker.rb', line 18

def initialize(action_id:, placeholder: nil, initial: nil, emoji: nil, focus_on_load: nil)
  @placeholder = placeholder_text(placeholder, emoji) if placeholder
  @initial_time = initial
  @action_id = action_id
  @focus_on_load = focus_on_load

  yield(self) if block_given?
end

Instance Method Details

#as_jsonObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/slack/block_kit/element/timepicker.rb', line 27

def as_json(*)
  {
    type: TYPE,
    action_id: @action_id,
    placeholder: @placeholder&.as_json,
    initial_time: @initial_time,
    focus_on_load: @focus_on_load,
    confirm: confirm&.as_json
  }.compact
end