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

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

Returns a new instance of IndependentActionCard.



80
81
82
83
# File 'lib/dingbot/message/action_card.rb', line 80

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

Instance Attribute Details

#buttonsObject

Returns the value of attribute buttons.



78
79
80
# File 'lib/dingbot/message/action_card.rb', line 78

def buttons
  @buttons
end

Instance Method Details

#body_paramsObject



85
86
87
88
# File 'lib/dingbot/message/action_card.rb', line 85

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