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 = '', buttons = [], btn_orientation = '0', hide_avatar = '0') ⇒ IndependentActionCard

Returns a new instance of IndependentActionCard.



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

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

Instance Attribute Details

#buttonsObject

Returns the value of attribute buttons.



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

def buttons
  @buttons
end

Instance Method Details

#body_paramsObject



61
62
63
64
# File 'lib/dingbot/message/action_card.rb', line 61

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