Class: DingBot::Message::IndependentActionCard

Inherits:
ActionCard show all
Defined in:
lib/dingbot/message/action_card.rb

Overview

独立跳转ActionCard类型

Instance Attribute Summary collapse

Attributes inherited from ActionCard

#btn_orientation, #hide_avatar, #text, #title

Instance Method Summary collapse

Methods inherited from ActionCard

#msg_type

Methods inherited from Base

#msg_type, #to_json

Constructor Details

#initialize(title = '', text = '', btn_orientation = '0', hide_avatar = '0', buttons = []) ⇒ IndependentActionCard

Returns a new instance of IndependentActionCard.



52
53
54
55
# File 'lib/dingbot/message/action_card.rb', line 52

def initialize(title='', text='', btn_orientation='0', hide_avatar='0', buttons=[])
  super(title, text, btn_orientation, hide_avatar)
  @buttons = buttons
end

Instance Attribute Details

#buttonsObject

Returns the value of attribute buttons.



50
51
52
# File 'lib/dingbot/message/action_card.rb', line 50

def buttons
  @buttons
end

Instance Method Details

#body_paramsObject



57
58
59
60
# File 'lib/dingbot/message/action_card.rb', line 57

def body_params
  action_card = super[:actionCard].merge(btns: @buttons.map {|btn| btn.format})
  super.merge(actionCard: action_card)
end