jackal-slack 0.1.8 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b87701a4853bb3f53734095eee911bbdd2a06cba
4
- data.tar.gz: 6ae66d510ab73a274b0232d18dcfd96fef40b509
3
+ metadata.gz: d7ba4f579722e2964ad616888c7faa63c0311c5e
4
+ data.tar.gz: 87ad15afdbaa67669ca644dd7827d34146ad774e
5
5
  SHA512:
6
- metadata.gz: 171454a666141a1a3f187b5d3b8f3e53260fb6ee5d4f21773978621b026c6fcff7b09d467d3c7d39bf66365a5d80ff960d868f76e57db398bd89ce7ee7343e0f
7
- data.tar.gz: d706a51cfccf2d8acd258ed096d43a4af5aaec7b94c72766c6dafede3bd14c4220746749d88509d5d36584600819f9dcde5d9777520d158fc4df898ad4d73cea
6
+ metadata.gz: eff8a0c45f56c52c5fe33ebe88ec8ad56dc52ae477c675306334eb0cc2fee005b895bec42701193bb0fe6f1969a1e444bc3b460d470cf9948db6ce9f3082e8ff
7
+ data.tar.gz: 9c8180b3ebbb78963512a170c6f46c4359a5ad8fe7554352240dab0f4f535db90be554ac33c145e23e56c6f1549d039b9f20ee3bcf6c0689d0436b060d67fb4f
@@ -1,3 +1,6 @@
1
+ # v0.1.10
2
+ * Remove messages from payload after delivery
3
+
1
4
  # v0.1.8
2
5
  * Add service registration
3
6
 
data/README.md CHANGED
@@ -11,7 +11,7 @@ Requires configured webhook endpoint from Slack:
11
11
  "jackal": {
12
12
  "config": {
13
13
  "slack": {
14
- "webhook": SLACK_WEBHOOK
14
+ "webhook_url": SLACK_WEBHOOK_URL
15
15
  }
16
16
  }
17
17
  }
@@ -6,11 +6,14 @@ Gem::Specification.new do |s|
6
6
  s.summary = 'Jackal Slack'
7
7
  s.author = 'Heavywater'
8
8
  s.email = 'support@hw-ops.com'
9
- s.homepage = 'http://github.com/heavywater/jackal-slack'
9
+ s.homepage = 'http://github.com/carnivore-rb/jackal-slack'
10
10
  s.description = 'Jackal Slack'
11
11
  s.license = 'Apache 2.0'
12
12
  s.require_path = 'lib'
13
13
  s.add_dependency 'jackal', '>= 0.3.3', '< 1.0'
14
14
  s.add_dependency 'slack-notifier', '~> 1.0'
15
+
16
+ s.add_development_dependency 'carnivore-actor'
17
+
15
18
  s.files = Dir['lib/**/*'] + %w(jackal-slack.gemspec README.md CHANGELOG.md CONTRIBUTING.md LICENSE)
16
19
  end
@@ -12,8 +12,10 @@ require 'jackal-slack/version'
12
12
  Jackal.service(
13
13
  :slack,
14
14
  :description => 'Send messages to Slack',
15
+ :category => :notifier,
15
16
  :configuration => {
16
17
  :webhook_url => {
18
+ :type => :string,
17
19
  :description => 'Webhook URL to send messages'
18
20
  }
19
21
  }
@@ -14,14 +14,17 @@ module Jackal
14
14
  # @return [Truthy, Falsey]
15
15
  def valid?(message)
16
16
  super do |payload|
17
- payload.get(:data, :slack)
17
+ config[:webhook_url] &&
18
+ payload.get(:data, :slack, :messages)
18
19
  end
19
20
  end
20
21
 
22
+ # Send messages to Slack
23
+ #
24
+ # @param message [Carnivore::Message]
21
25
  def execute(message)
22
26
  failure_wrap(message) do |payload|
23
27
  payload[:data][:slack][:messages].each do |slack_msg|
24
- notifier = slack_notifier
25
28
  msg = slack_msg[:message].to_s
26
29
  msg_attachment = {
27
30
  fallback: msg,
@@ -29,19 +32,24 @@ module Jackal
29
32
  color: slack_msg[:color],
30
33
  mrkdwn_in: slack_msg.fetch(:markdown, true) ? [:text, :fallback] : []
31
34
  }
32
- notifier.ping(
33
- slack_msg.fetch(:description, 'Result:'),
34
- attachments: [msg_attachment]
35
- )
35
+
36
+ desc = slack_msg.fetch(:description, 'Result:')
37
+ post_to_slack(desc, [msg_attachment])
36
38
  end
39
+ payload[:data][:slack].delete(:messages)
37
40
  job_completed(:slack_notification, payload, message)
38
41
  end
39
42
  end
40
43
 
41
- # Return slack_notifier object using team & token from data or config
42
- # depending on what's loaded in the environment
43
- def slack_notifier
44
- ::Slack::Notifier.new(config[:webhook_url])
44
+ # Post message to Slack
45
+ #
46
+ # @param description [String] slack output description
47
+ # @param attachments [Array<Hash>] slack output attachments
48
+ # @return [TrueClass]
49
+ def post_to_slack(description, attachments)
50
+ notifier = ::Slack::Notifier.new(config[:webhook_url])
51
+ notifier.ping(description, attachments: attachments)
52
+ true
45
53
  end
46
54
 
47
55
  end
@@ -1,6 +1,6 @@
1
1
  module Jackal
2
2
  module Slack
3
3
  # current library version
4
- VERSION = Gem::Version.new('0.1.8')
4
+ VERSION = Gem::Version.new('0.1.10')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jackal-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heavywater
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-21 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jackal
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: '1.0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: carnivore-actor
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
47
61
  description: Jackal Slack
48
62
  email: support@hw-ops.com
49
63
  executables: []
@@ -60,7 +74,7 @@ files:
60
74
  - lib/jackal-slack/formatter/error.rb
61
75
  - lib/jackal-slack/notification.rb
62
76
  - lib/jackal-slack/version.rb
63
- homepage: http://github.com/heavywater/jackal-slack
77
+ homepage: http://github.com/carnivore-rb/jackal-slack
64
78
  licenses:
65
79
  - Apache 2.0
66
80
  metadata: {}