slackert 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 +4 -4
- data/README.md +7 -6
- data/lib/slackert/alerter.rb +4 -1
- data/lib/slackert/blocks.rb +4 -1
- data/lib/slackert/version.rb +1 -1
- data/slackert.gemspec +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7769c1f1174a00c0e85dfac8329b6b78a230d62d8b5ae2b07359268717766f0d
|
|
4
|
+
data.tar.gz: 426822eda9c6c1a1e397d77db834b49a5219ca5dd10f346e06291e179d794be6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6f4be1b447525deca2b4313ac70641a5dfd5fed1298984861d915851f40232b02ff205008790ea78ede087c9401197109ad3a9b3a1922178d7f58f6a22f785b6
|
|
7
|
+
data.tar.gz: 2e913970b4885b4fa1f814601ea8c6afc2748ccdaad0c51eb5ac55f87acd7688505d06ebb15107b039754b2fa502a939cae93fe4a7143e7bb3718dc1fe24bac4
|
data/README.md
CHANGED
|
@@ -8,16 +8,15 @@ Especially useful for logging and alerting, supports three logging levels `Error
|
|
|
8
8
|
|
|
9
9
|
Add Slacker to your Gemfile
|
|
10
10
|
|
|
11
|
-
gem 'slackert'
|
|
11
|
+
gem 'slackert'
|
|
12
12
|
|
|
13
13
|
Then
|
|
14
14
|
|
|
15
15
|
$ bundle install
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
<!-- Or install it yourself as:
|
|
17
|
+
Or install it yourself as:
|
|
19
18
|
|
|
20
|
-
$ gem install slackert
|
|
19
|
+
$ gem install slackert
|
|
21
20
|
|
|
22
21
|
## Usage
|
|
23
22
|
|
|
@@ -113,13 +112,15 @@ Templates optimize the process of creating and sending alerts by providing layou
|
|
|
113
112
|
#### Examples
|
|
114
113
|
|
|
115
114
|
#### Job Executed
|
|
115
|
+
|
|
116
116
|
<br>
|
|
117
|
-
<img src="
|
|
117
|
+
<img src="https://raw.githubusercontent.com/braze-inc/braze-growth-shares-slackert/master/screenshots/job-executed.png" width="600" height="309">
|
|
118
118
|
<br>
|
|
119
119
|
|
|
120
120
|
#### Job Error
|
|
121
|
+
|
|
121
122
|
<br>
|
|
122
|
-
<img src="
|
|
123
|
+
<img src="https://raw.githubusercontent.com/braze-inc/braze-growth-shares-slackert/master/screenshots/job-error.png" width="600" height="281">
|
|
123
124
|
<br>
|
|
124
125
|
|
|
125
126
|
### Logging Level
|
data/lib/slackert/alerter.rb
CHANGED
|
@@ -53,7 +53,10 @@ module Slackert
|
|
|
53
53
|
req = base_post_req
|
|
54
54
|
req.body = content.to_json
|
|
55
55
|
res = @https.request(req)
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
if res.code != '200'
|
|
58
|
+
puts "Slackert::Slack message sending unsuccesful (Code: #{res.code}, Message: #{res.read_body})"
|
|
59
|
+
end
|
|
57
60
|
end
|
|
58
61
|
|
|
59
62
|
def base_post_req
|
data/lib/slackert/blocks.rb
CHANGED
|
@@ -89,6 +89,8 @@ module Slackert
|
|
|
89
89
|
# @param type [String] can be either mrkdwn or plain_text
|
|
90
90
|
#
|
|
91
91
|
def add_section_text(message, type = 'mrkdwn')
|
|
92
|
+
raise ArgumentError, 'Maximum number of characters in text exceeded' if message.length > 3000
|
|
93
|
+
|
|
92
94
|
@text = {
|
|
93
95
|
'type': type,
|
|
94
96
|
'text': message
|
|
@@ -103,7 +105,8 @@ module Slackert
|
|
|
103
105
|
# @raise [RuntimeError] if maximum capacity of 10 field objects has been reached
|
|
104
106
|
#
|
|
105
107
|
def add_field_text(message, type = 'mrkdwn')
|
|
106
|
-
raise 'Maximum field text objects has been reached.' if @fields.length == 10
|
|
108
|
+
raise StandardError, 'Maximum field text objects has been reached.' if @fields.length == 10
|
|
109
|
+
raise ArgumentError, 'Maximum number of characters in text exceeded' if message.length > 2000
|
|
107
110
|
|
|
108
111
|
@fields.push(
|
|
109
112
|
{
|
data/lib/slackert/version.rb
CHANGED
data/slackert.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: slackert
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Maciej Olko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-02-
|
|
11
|
+
date: 2021-02-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|