lib/slack/plugin.rb in danger-slack-0.0.1 vs lib/slack/plugin.rb in danger-slack-0.0.2

- old
+ new

@@ -32,28 +32,35 @@ @conn = Faraday.new(url: 'https://slack.com/api') end # get slack team members + # For more information, see also https://api.slack.com/methods/users.list # # @return [[Hash]] def members res = @conn.get 'users.list', token: @api_token Array(JSON.parse(res.body)['members']) end - # get slack team members + # get slack team channels + # For more information, see also https://api.slack.com/methods/channels.list # # @return [[Hash]] def channels res = @conn.get 'channels.list', token: @api_token Array(JSON.parse(res.body)['channels']) end # notify to Slack - # A method that you can call from your Dangerfile + # + # @param [String] channel + # It is channel to be notified, defaults to '#general' + # @param [String] text + # text message posted to slack, defaults to nil. + # if nil, this method post danger reports to slack. # @return [void] - def notify(channel:, text: nil, **opts) + def notify(channel: '#general', text: nil, **opts) attachments = text.nil? ? report : [] text ||= '<http://danger.systems/|Danger> reports' @conn.post do |req| req.url 'chat.postMessage' req.params = {