lib/slackistrano.rb in slackistrano-0.1.3 vs lib/slackistrano.rb in slackistrano-0.1.4
- old
+ new
@@ -21,21 +21,21 @@
end
#
#
#
- def self.post_as_slackbot(team: nil, token: nil, webhook: webhook, payload: {})
+ def self.post_as_slackbot(team: nil, token: nil, webhook: nil, payload: {})
uri = URI(URI.encode("https://#{team}.slack.com/services/hooks/slackbot?token=#{token}&channel=#{payload[:channel]}"))
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
http.request_post uri.request_uri, payload[:text]
end
end
#
#
#
- def self.post_as_webhook(team: nil, token: nil, webhook: webhook, payload: {})
+ def self.post_as_webhook(team: nil, token: nil, webhook: nil, payload: {})
params = {'payload' => payload.to_json}
if webhook.nil?
webhook = "https://#{team}.slack.com/services/hooks/incoming-webhook"
params.merge!('token' => token)