Class: DingBot::Message::ActionCard

Inherits:
Base
  • Object
show all
Defined in:
lib/dingbot/message/action_card.rb

Overview

ActionCard基类

Direct Known Subclasses

IndependentActionCard, WholeActionCard

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#to_json

Constructor Details

#initialize(title = '', text = '', btn_orientation = '0', hide_avatar = '0') ⇒ ActionCard

Returns a new instance of ActionCard.



8
9
10
11
12
13
# File 'lib/dingbot/message/action_card.rb', line 8

def initialize(title='', text='', btn_orientation='0', hide_avatar='0')
  @title = title
  @text = text
  @btn_orientation = btn_orientation
  @hide_avatar = hide_avatar
end

Instance Attribute Details

#btn_orientationObject

Returns the value of attribute btn_orientation.



6
7
8
# File 'lib/dingbot/message/action_card.rb', line 6

def btn_orientation
  @btn_orientation
end

#hide_avatarObject

Returns the value of attribute hide_avatar.



6
7
8
# File 'lib/dingbot/message/action_card.rb', line 6

def hide_avatar
  @hide_avatar
end

#textObject

Returns the value of attribute text.



6
7
8
# File 'lib/dingbot/message/action_card.rb', line 6

def text
  @text
end

#titleObject

Returns the value of attribute title.



6
7
8
# File 'lib/dingbot/message/action_card.rb', line 6

def title
  @title
end

Instance Method Details

#body_paramsObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/dingbot/message/action_card.rb', line 19

def body_params
  super.merge(
      actionCard: {
          title: @title,
          text: @text,
          hideAvatar: @hide_avatar,
          btnOrientation: @btn_orientation,
      }
  )
end

#msg_typeObject



15
16
17
# File 'lib/dingbot/message/action_card.rb', line 15

def msg_type
  TYPE::ACTION_CARD
end