slack_notifier_wrapper 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a939672f9e2980fe1ddacb41450ffc18e8f967f
4
- data.tar.gz: 14e61c6238fb9115559e247a5163396d4277f2fb
3
+ metadata.gz: 544801374847a42ab0ab512bc121415c428bc81b
4
+ data.tar.gz: 19aa5f01f32fc051d06b1661d1bc119a7255f61a
5
5
  SHA512:
6
- metadata.gz: fe68af34b4125f928390fba70b7d206c6ef98ca142065cf9c21ae0fd1e94e9226fa63e784eb5c54e61068994cc4d08b231367d6782c1589e95912ef128e8ac59
7
- data.tar.gz: 248b6ff0105e6a9b81999665abca3d7367a9a969d80af2c6fab492b0f4b864a22b2070d14e7ec3a8e49719537b92570b1fe5cec5b75414e359c2011bc562fc58
6
+ metadata.gz: 9c543209a6d74af7daf7baa49cd875e5fc960d2517cd7dafbc20058d8210a6e814c933c0c9acc429423ee98c0cd0e29714016a969c8e4fc469224add10f6a459
7
+ data.tar.gz: 6cb909419b520262534fd3b6a275013af8c04a878f23f3461dd35caf4916c2a3ee68176a93138ae241dbb670d64a7284eb8793a2f0d2895f5970c2b13ea5baff
@@ -0,0 +1,16 @@
1
+ module SlackNotifierWrapper
2
+ module Helpers
3
+
4
+ def execute_or_speak(method)
5
+ begin
6
+ send(method)
7
+ rescue Exception => e
8
+ attachment_message = "#{self.class}##{method_name} failed to execute"
9
+ SlackNotifierWrapper.speak_attachments({ color: "danger", attachment_message: attachment_message })
10
+ raise e
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+
@@ -1,3 +1,3 @@
1
1
  module SlackNotifierWrapper
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "slack_notifier_wrapper/version"
2
+ require "slack_notifier_wrapper/helpers"
2
3
 
3
4
  module SlackNotifierWrapper
4
5
 
@@ -8,13 +9,13 @@ module SlackNotifierWrapper
8
9
  notifier.ping message, icon_emoji: @icon_emoji
9
10
  end
10
11
 
11
- def speak_attachments(message, attachment_message, color)
12
+ def speak_attachments(args)
12
13
  {
13
14
  text: args.fetch(:attachment_message, ""),
14
- color: color,
15
+ color: args.fetch(:color, "good"),
15
16
  mrkdwn_in: ["text"]
16
17
  }
17
- notifier.ping message, icon_emoji: @icon_emoji, attachments: [attachments]
18
+ notifier.ping args.fetch(:message, ""), icon_emoji: @icon_emoji, attachments: [attachments]
18
19
  end
19
20
 
20
21
  def notifier
@@ -44,3 +45,4 @@ module SlackNotifierWrapper
44
45
  end
45
46
 
46
47
  end
48
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_notifier_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MrPowers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-08 00:00:00.000000000 Z
11
+ date: 2015-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,6 +84,7 @@ files:
84
84
  - bin/console
85
85
  - bin/setup
86
86
  - lib/slack_notifier_wrapper.rb
87
+ - lib/slack_notifier_wrapper/helpers.rb
87
88
  - lib/slack_notifier_wrapper/version.rb
88
89
  - slack_notifier_wrapper.gemspec
89
90
  homepage: https://github.com/mrpowers/slack_notifier_wrapper