Skip to content

Instantly share code, notes, and snippets.

@tomohiro
Created May 24, 2016 13:15
Show Gist options
  • Save tomohiro/218f65a029a4d9a2634b3e609044da6f to your computer and use it in GitHub Desktop.
Save tomohiro/218f65a029a4d9a2634b3e609044da6f to your computer and use it in GitHub Desktop.
Redmine notifier to Slack
require 'dotenv'
Dotenv.load
require 'slack-notifier'
require 'json'
require 'redmine-ruby'
module Redmine
class Issue < Base
collection_path 'issues.xml'
resource_path 'issues/:id.xml'
scope :recent_updated, -> { where(sort: 'updated_on:desc') }
end
end
notifier = Slack::Notifier.new ENV['SLACK_WEBHOOK_URL']
redmine = Redmine::Client.new(ENV['REDMINE_URL'], ENV['REDMINE_TOKEN'])
notifier.ping redmine.issues.recent_updated.first.subject
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment