Class: Danger::DangerChatwork
- Inherits:
-
Plugin
- Object
- Plugin
- Danger::DangerChatwork
- Defined in:
- lib/chatwork/plugin.rb
Instance Attribute Summary collapse
-
#api_token ⇒ String
writeonly
API token to authenticate with ChatWork API.
Instance Method Summary collapse
-
#initialize(dangerfile) ⇒ DangerChatwork
constructor
A new instance of DangerChatwork.
- #notify(room_id:, text: '') ⇒ Object
Constructor Details
#initialize(dangerfile) ⇒ DangerChatwork
Returns a new instance of DangerChatwork.
11 12 13 14 |
# File 'lib/chatwork/plugin.rb', line 11 def initialize(dangerfile) super(dangerfile) self.api_token = ENV['CHATWORK_API_TOKEN'] end |
Instance Attribute Details
#api_token=(value) ⇒ String (writeonly)
API token to authenticate with ChatWork API
9 10 11 |
# File 'lib/chatwork/plugin.rb', line 9 def api_token=(value) @api_token = value end |
Instance Method Details
#notify(room_id:, text: '') ⇒ Object
16 17 18 19 20 21 |
# File 'lib/chatwork/plugin.rb', line 16 def notify(room_id:, text: '') return ChatWork::Message.create(room_id: room_id, body: text) unless text.empty? return if reports.empty? report = "[info][title]Danger Report[/title]#{pr_info}\n#{reports.join("\n")}[/info]" ChatWork::Message.create(room_id: room_id, body: report) end |