Class: Slack::BlockKit::Element::DatePickerElement

Inherits:
Slack::BlockKit::Element show all
Defined in:
lib/slack/block_kit/element/date_picker_element.rb

Instance Attribute Summary collapse

Attributes inherited from Slack::BlockKit::Element

#action_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Slack::BlockKit::Element

[], #valid?

Instance Attribute Details

#confirmObject

Returns the value of attribute confirm.



8
9
10
# File 'lib/slack/block_kit/element/date_picker_element.rb', line 8

def confirm
  @confirm
end

#initial_dateObject

Returns the value of attribute initial_date.



8
9
10
# File 'lib/slack/block_kit/element/date_picker_element.rb', line 8

def initial_date
  @initial_date
end

#placeholderObject

Returns the value of attribute placeholder.



8
9
10
# File 'lib/slack/block_kit/element/date_picker_element.rb', line 8

def placeholder
  @placeholder
end

Class Method Details

.populate(hash, object) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/slack/block_kit/element/date_picker_element.rb', line 10

def self.populate(hash, object)
  object.placeholder = hash.fetch(:placeholder) if hash[:placeholder]
  object.confirm = hash.fetch(:confirm) if hash[:confirm]
  object.initial_date = hash.fetch(:initial_date) if hash[:initial_date]

  super(hash, object)
end

Instance Method Details

#to_hObject



46
47
48
49
50
51
52
# File 'lib/slack/block_kit/element/date_picker_element.rb', line 46

def to_h
  super.merge(
    initial_date: initial_date,
    placeholder: placeholder&.to_h,
    confirm: confirm&.to_h
  ).compact
end

#typeObject



18
19
20
# File 'lib/slack/block_kit/element/date_picker_element.rb', line 18

def type
  'datepicker'
end