fde-slack-notification 1.1.1 → 1.2.0

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
  SHA256:
3
- metadata.gz: b075fa4ed98e1df95a32d2ccf2b69b688a809f6010ffeeb02045a610f97a4845
4
- data.tar.gz: 380b9150c38755338e3a36b87c5ebf2444130c69c29e926fc5484c8391abdd6e
3
+ metadata.gz: a20eba73bb6a23557f8c50bf62e18db309acc10d3a2c614044410e58d21159cd
4
+ data.tar.gz: f69a8ff4a3e7dc9f1e77fec4fd1620465482f3b5f984651db8699c6ec20df2c9
5
5
  SHA512:
6
- metadata.gz: 28ab900d7b7eb426ef8af17e71508ad1b1896262ace21247bbb9bc8eca4d72f3208f16f70cf80ce6158f53443c75c60678dfc84cb77ef5d1ed4b7bfe4d919a0f
7
- data.tar.gz: 30aac486d6a6448dee049a93799ad5f433a3a99714daee2f5e5dd69f1be97713d1285dabde23f7da38742365843abc7853269d541687d4dd11e583c52cc0a82e
6
+ metadata.gz: 2a349ab08a8f708b3931a7fb3989783ded0ec850e0c5f82cf8162e157ea035cdc3e70994ac4b8374e980d51c0dc341ddadb4a685ea9deef9c376a4f44959fd72
7
+ data.tar.gz: 87e1206d0651f531c8d7447a1672dec6b7aa50ce5f3e8f40ec8b57db69ad0ea4af19b5fda592fa070d3a5dd7bc30388835db6c0201d9a9c55d6b7e13080ba5c4
data/README.md CHANGED
@@ -3,3 +3,87 @@
3
3
  [![Code Climate](https://codeclimate.com/github/fashion-data-exchange/slack-notification/badges/gpa.svg)](https://codeclimate.com/github/fashion-data-exchange/slack-notification)
4
4
 
5
5
  # Slack::Notification
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'fde-slack-notification'
12
+ ```
13
+ And then execute:
14
+
15
+ ```bash
16
+ bundle install
17
+ ```
18
+
19
+ ### Authorization
20
+
21
+ The client requires the following environment variables to be set:
22
+
23
+ ```bash
24
+ SLACK_FD_WEBHOOK_URL = 'https://hooks.slack.com' //Your slack hook here
25
+ ```
26
+
27
+ ### Usage
28
+
29
+ In order to send a notification to slack, you can write a method like the following.
30
+
31
+ ```ruby
32
+ def notifier
33
+ message = FDE::Slack::Message.new(
34
+ 'your message title',
35
+ fields,
36
+ {
37
+ title_link:
38
+ {
39
+ title: 'title',
40
+ title_link: 'title',
41
+ thumb_url: 'author_icon'
42
+ },
43
+ footer: FDE::Slack::Footer.new('footer_text).to_h
44
+ }
45
+ )
46
+
47
+ message.info(channel)
48
+ end
49
+
50
+
51
+ # create a hash for your required fields
52
+ def fields
53
+ [
54
+ {
55
+ title: 'Field 1',
56
+ value: 'value 1',
57
+ short: false
58
+ },
59
+ {
60
+ title: 'Field 2',
61
+ value: 'value 2',
62
+ short: false
63
+ },
64
+ ]
65
+ end
66
+
67
+ ```
68
+
69
+ ### Configuration
70
+
71
+ To set the hook_url value, you may have an initializer under `config/initializers` like this
72
+
73
+ ```ruby
74
+ require "slack/notification"
75
+
76
+ FDE::Slack::Notification.configure do |config|
77
+ config.webhook = 'hook_url'
78
+ end
79
+ ```
80
+
81
+
82
+ ### Styling
83
+
84
+ Any of these methods can be used to get the following colored sidebars
85
+
86
+ 1. message.info(channel) # BLUE
87
+ 2. message.success(channel) # GREEN
88
+ 3. message.error(channel) # RED
89
+ 4. message.warning(channel) # YELLOW
@@ -30,17 +30,17 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_runtime_dependency "slack-notifier", "~> 1.5", ">= 1.5.1"
33
+ spec.add_runtime_dependency "slack-notifier", "~> 2.0"
34
34
  spec.add_runtime_dependency "dotenv", "~> 2.2", ">= 2.2.1"
35
35
 
36
- spec.add_development_dependency "bundler", "~> 1.15"
36
+ spec.add_development_dependency "bundler", "~> 2"
37
37
  spec.add_development_dependency "rake", "~> 10.0"
38
- spec.add_development_dependency "rspec", "~> 3.0"
39
- spec.add_development_dependency "rdoc", "~> 5.1", ">= 5.1"
38
+ spec.add_development_dependency "rspec", "~> 3"
39
+ spec.add_development_dependency "rdoc", "~> 5"
40
40
  spec.add_development_dependency "vcr", "~> 3.0.3", ">= 3.0.3"
41
41
  spec.add_development_dependency 'webmock', '~> 3.0', '>= 3.0.1'
42
42
 
43
- spec.add_development_dependency "pry", "~> 0.10"
44
- spec.add_development_dependency "pry-remote", "~> 0.1"
45
- spec.add_development_dependency "pry-nav", "~> 0.2"
43
+ spec.add_development_dependency "pry", "~> 0"
44
+ spec.add_development_dependency "pry-remote", "~> 0"
45
+ spec.add_development_dependency "pry-nav", "~> 0"
46
46
  end
data/lib/slack/message.rb CHANGED
@@ -72,7 +72,7 @@ module FDE
72
72
  )
73
73
  begin
74
74
  notifier.ping message_hash
75
- rescue Slack::Notifier::APIError
75
+ rescue ::Slack::Notifier::APIError
76
76
  raise FDE::Slack::Message::Error
77
77
  end
78
78
  end
@@ -1,7 +1,7 @@
1
1
  module FDE
2
2
  module Slack
3
3
  module Notification
4
- VERSION = "1.1.1"
4
+ VERSION = "1.2.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fde-slack-notification
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Langenegger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-02-19 00:00:00.000000000 Z
11
+ date: 2020-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slack-notifier
@@ -16,20 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.5'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 1.5.1
19
+ version: '2.0'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '1.5'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 1.5.1
26
+ version: '2.0'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: dotenv
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -56,14 +50,14 @@ dependencies:
56
50
  requirements:
57
51
  - - "~>"
58
52
  - !ruby/object:Gem::Version
59
- version: '1.15'
53
+ version: '2'
60
54
  type: :development
61
55
  prerelease: false
62
56
  version_requirements: !ruby/object:Gem::Requirement
63
57
  requirements:
64
58
  - - "~>"
65
59
  - !ruby/object:Gem::Version
66
- version: '1.15'
60
+ version: '2'
67
61
  - !ruby/object:Gem::Dependency
68
62
  name: rake
69
63
  requirement: !ruby/object:Gem::Requirement
@@ -84,34 +78,28 @@ dependencies:
84
78
  requirements:
85
79
  - - "~>"
86
80
  - !ruby/object:Gem::Version
87
- version: '3.0'
81
+ version: '3'
88
82
  type: :development
89
83
  prerelease: false
90
84
  version_requirements: !ruby/object:Gem::Requirement
91
85
  requirements:
92
86
  - - "~>"
93
87
  - !ruby/object:Gem::Version
94
- version: '3.0'
88
+ version: '3'
95
89
  - !ruby/object:Gem::Dependency
96
90
  name: rdoc
97
91
  requirement: !ruby/object:Gem::Requirement
98
92
  requirements:
99
93
  - - "~>"
100
94
  - !ruby/object:Gem::Version
101
- version: '5.1'
102
- - - ">="
103
- - !ruby/object:Gem::Version
104
- version: '5.1'
95
+ version: '5'
105
96
  type: :development
106
97
  prerelease: false
107
98
  version_requirements: !ruby/object:Gem::Requirement
108
99
  requirements:
109
100
  - - "~>"
110
101
  - !ruby/object:Gem::Version
111
- version: '5.1'
112
- - - ">="
113
- - !ruby/object:Gem::Version
114
- version: '5.1'
102
+ version: '5'
115
103
  - !ruby/object:Gem::Dependency
116
104
  name: vcr
117
105
  requirement: !ruby/object:Gem::Requirement
@@ -158,42 +146,42 @@ dependencies:
158
146
  requirements:
159
147
  - - "~>"
160
148
  - !ruby/object:Gem::Version
161
- version: '0.10'
149
+ version: '0'
162
150
  type: :development
163
151
  prerelease: false
164
152
  version_requirements: !ruby/object:Gem::Requirement
165
153
  requirements:
166
154
  - - "~>"
167
155
  - !ruby/object:Gem::Version
168
- version: '0.10'
156
+ version: '0'
169
157
  - !ruby/object:Gem::Dependency
170
158
  name: pry-remote
171
159
  requirement: !ruby/object:Gem::Requirement
172
160
  requirements:
173
161
  - - "~>"
174
162
  - !ruby/object:Gem::Version
175
- version: '0.1'
163
+ version: '0'
176
164
  type: :development
177
165
  prerelease: false
178
166
  version_requirements: !ruby/object:Gem::Requirement
179
167
  requirements:
180
168
  - - "~>"
181
169
  - !ruby/object:Gem::Version
182
- version: '0.1'
170
+ version: '0'
183
171
  - !ruby/object:Gem::Dependency
184
172
  name: pry-nav
185
173
  requirement: !ruby/object:Gem::Requirement
186
174
  requirements:
187
175
  - - "~>"
188
176
  - !ruby/object:Gem::Version
189
- version: '0.2'
177
+ version: '0'
190
178
  type: :development
191
179
  prerelease: false
192
180
  version_requirements: !ruby/object:Gem::Requirement
193
181
  requirements:
194
182
  - - "~>"
195
183
  - !ruby/object:Gem::Version
196
- version: '0.2'
184
+ version: '0'
197
185
  description: A simple slack client to send messages into a slack channel
198
186
  email:
199
187
  - f.langenegger@fadendaten.ch