slack_webhook_logger 0.5.0 → 0.5.2

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
  SHA256:
3
- metadata.gz: a8aca45921ee3b9d9bcecb993e4b4ef9f30b7853e802babce6e0f5b208ddd2ca
4
- data.tar.gz: abaf6b83376d4e412d6971b6885f2c3de02a3191f07a6ea7909aa77c5f0c99e1
3
+ metadata.gz: f65b62b9f156ae454fec95c6ffecdd53c175970ec14cb3d06d24e8b64d692ad6
4
+ data.tar.gz: a99595d6bf1356de86f20fd6946ad9e8f8a8d48901cd3d9431736bea89f35701
5
5
  SHA512:
6
- metadata.gz: db1edd27e70437d26658f21caf2424b02ff3d0ca1436e56fea8888f608e8f9799b179fd61f2e63e8c3c17134d865d6796d5f66a48ac9ea3c3225152f5681630f
7
- data.tar.gz: 2702fd661d5bf78050cf82033e2ea60ce65a201fa4cc28ae63bb8f8013abeac6ed7a452725231a83568c01d4032067c5e0d87b010573ac64b0beaaf37719d0d8
6
+ metadata.gz: 203cda370e20c98232df09f33701811ed7dbc20d8c03b22e680d5f3f4220d0cc8bc92ed9c6c7faa5ce4997320f17f43ac798b5c13d6f5ffee9b7a325fb395b14
7
+ data.tar.gz: f25193c1bb42d465b973aaf9df6ba92a00bae54c96594da1f399b2a722c63026bde49f04dc17761f2e55050ecefac2ef610d98bc983a44ddd4cd4ee11da20e7e
data/.gitignore CHANGED
@@ -1,8 +1,30 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- tmp/
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+ vendor/cache
15
+
16
+ Gemfile.lock
17
+ out/
18
+ sample.rb
19
+ run_sample.rb
20
+ src/
21
+ docs/
22
+
23
+ # YARD artifacts
24
+ .yardoc
25
+ _yardoc
26
+
27
+ .DS_Store
28
+ .idea
29
+ .byebug_history
30
+ .vscode
data/CHANGELOG.md CHANGED
@@ -1,2 +1,6 @@
1
+ ## [v0.5.1] - 06-07-2023
2
+ null
3
+ ## [v0.5.0] - 05-07-2023
4
+ null
1
5
  ## [v0.5.0] - 05-07-2023
2
6
  null
data/Gemfile CHANGED
@@ -5,9 +5,9 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in slack-webhooklogger.gemspec
6
6
  gemspec
7
7
 
8
- gem 'minitest', '~> 5.18'
9
- gem 'rake', '~> 13.0'
10
- gem 'rubocop', '~> 1.6'
8
+ gem "minitest", "~> 5.18"
9
+ gem "rake", "~> 13.0"
10
+ gem "rubocop", "~> 1.6"
11
11
  gem "rubocop-standard"
12
12
 
13
13
  gem "webmock", "~> 3.11"
@@ -4,6 +4,8 @@ module SlackWebhookLogger
4
4
  class Formatter < ::Logger::Formatter
5
5
  attr_writer :format
6
6
 
7
+ MAX_LENGTH = 20000
8
+
7
9
  def format
8
10
  @format ||= proc do |severity, time, _progname, msg|
9
11
  heading = case severity
@@ -27,7 +29,7 @@ module SlackWebhookLogger
27
29
  #{msg2str(msg)}
28
30
  MSG
29
31
 
30
- slackify(title, text)
32
+ slackify(truncate(title), truncate(text))
31
33
  end
32
34
  end
33
35
 
@@ -71,5 +73,9 @@ module SlackWebhookLogger
71
73
  msg.inspect
72
74
  end
73
75
  end
76
+
77
+ private def truncate(string)
78
+ string.length > MAX_LENGTH ? "#{string[0...MAX_LENGTH]}..." : string
79
+ end
74
80
  end
75
81
  end
@@ -16,15 +16,16 @@ module SlackWebhookLogger
16
16
 
17
17
  return if SlackWebhookLogger.ignore_patterns.any? { |ignore_pattern| hash[:text].match(ignore_pattern) }
18
18
 
19
- response = HTTPX.post(SlackWebhookLogger.webhook_uri.to_s, form: hash)
19
+ response = HTTPX.with(headers: { "content-type" => "application/json" }).post(SlackWebhookLogger.webhook_uri.to_s, form: hash)
20
20
 
21
21
  return if (200..299).cover?(response.status)
22
22
 
23
+ error_prefix = "slack_webhook_logger failed.\nRequest: #{hash}\nResponse:"
23
24
  case response
24
25
  when HTTPX::ErrorResponse
25
- warn(response)
26
+ warn("#{error_prefix} #{response}")
26
27
  else
27
- warn(response.body)
28
+ warn("#{error_prefix} #{response.status} #{response.body}")
28
29
  end
29
30
  end
30
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SlackWebhookLogger
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_webhook_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-05 00:00:00.000000000 Z
11
+ date: 2023-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,6 +30,7 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8.0'
33
+ force_ruby_platform: false
33
34
  - !ruby/object:Gem::Dependency
34
35
  name: httpx
35
36
  requirement: !ruby/object:Gem::Requirement
@@ -44,6 +45,7 @@ dependencies:
44
45
  - - "~>"
45
46
  - !ruby/object:Gem::Version
46
47
  version: '0.20'
48
+ force_ruby_platform: false
47
49
  - !ruby/object:Gem::Dependency
48
50
  name: railties
49
51
  requirement: !ruby/object:Gem::Requirement
@@ -64,6 +66,7 @@ dependencies:
64
66
  - - "<"
65
67
  - !ruby/object:Gem::Version
66
68
  version: '8.0'
69
+ force_ruby_platform: false
67
70
  description:
68
71
  email:
69
72
  - gjtorikian@gmail.com
@@ -84,7 +87,6 @@ files:
84
87
  - CHANGELOG.md
85
88
  - CODE_OF_CONDUCT.md
86
89
  - Gemfile
87
- - Gemfile.lock
88
90
  - LICENSE.txt
89
91
  - README.md
90
92
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,158 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- slack_webhook_logger (0.5.0)
5
- activesupport (>= 5.0, < 8.0)
6
- httpx (~> 0.20)
7
- railties (>= 5.0, < 8.0)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actionpack (7.0.6)
13
- actionview (= 7.0.6)
14
- activesupport (= 7.0.6)
15
- rack (~> 2.0, >= 2.2.4)
16
- rack-test (>= 0.6.3)
17
- rails-dom-testing (~> 2.0)
18
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
19
- actionview (7.0.6)
20
- activesupport (= 7.0.6)
21
- builder (~> 3.1)
22
- erubi (~> 1.4)
23
- rails-dom-testing (~> 2.0)
24
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
25
- activesupport (7.0.6)
26
- concurrent-ruby (~> 1.0, >= 1.0.2)
27
- i18n (>= 1.6, < 2)
28
- minitest (>= 5.1)
29
- tzinfo (~> 2.0)
30
- addressable (2.8.4)
31
- public_suffix (>= 2.0.2, < 6.0)
32
- amazing_print (1.5.0)
33
- ast (2.4.2)
34
- builder (3.2.4)
35
- concurrent-ruby (1.2.2)
36
- crack (0.4.5)
37
- rexml
38
- crass (1.0.6)
39
- debug (1.8.0)
40
- irb (>= 1.5.0)
41
- reline (>= 0.3.1)
42
- erubi (1.12.0)
43
- hashdiff (1.0.1)
44
- http-2-next (0.5.1)
45
- httpx (0.24.1)
46
- http-2-next (>= 0.4.1)
47
- i18n (1.14.1)
48
- concurrent-ruby (~> 1.0)
49
- io-console (0.6.0)
50
- irb (1.7.1)
51
- reline (>= 0.3.0)
52
- json (2.6.3)
53
- language_server-protocol (3.17.0.3)
54
- loofah (2.21.3)
55
- crass (~> 1.0.2)
56
- nokogiri (>= 1.12.0)
57
- method_source (1.0.0)
58
- minitest (5.18.1)
59
- mocha (2.0.4)
60
- ruby2_keywords (>= 0.0.5)
61
- nokogiri (1.15.3-arm64-darwin)
62
- racc (~> 1.4)
63
- nokogiri (1.15.3-x86_64-linux)
64
- racc (~> 1.4)
65
- parallel (1.23.0)
66
- parser (3.2.2.3)
67
- ast (~> 2.4.1)
68
- racc
69
- public_suffix (5.0.1)
70
- racc (1.7.1)
71
- rack (2.2.7)
72
- rack-test (2.1.0)
73
- rack (>= 1.3)
74
- rails-dom-testing (2.1.1)
75
- activesupport (>= 5.0.0)
76
- minitest
77
- nokogiri (>= 1.6)
78
- rails-html-sanitizer (1.6.0)
79
- loofah (~> 2.21)
80
- nokogiri (~> 1.14)
81
- railties (7.0.6)
82
- actionpack (= 7.0.6)
83
- activesupport (= 7.0.6)
84
- method_source
85
- rake (>= 12.2)
86
- thor (~> 1.0)
87
- zeitwerk (~> 2.5)
88
- rainbow (3.1.1)
89
- rake (13.0.6)
90
- regexp_parser (2.8.1)
91
- reline (0.3.5)
92
- io-console (~> 0.5)
93
- rexml (3.2.5)
94
- rubocop (1.54.1)
95
- json (~> 2.3)
96
- language_server-protocol (>= 3.17.0)
97
- parallel (~> 1.10)
98
- parser (>= 3.2.2.3)
99
- rainbow (>= 2.2.2, < 4.0)
100
- regexp_parser (>= 1.8, < 3.0)
101
- rexml (>= 3.2.5, < 4.0)
102
- rubocop-ast (>= 1.28.0, < 2.0)
103
- ruby-progressbar (~> 1.7)
104
- unicode-display_width (>= 2.4.0, < 3.0)
105
- rubocop-ast (1.29.0)
106
- parser (>= 3.2.1.0)
107
- rubocop-minitest (0.31.0)
108
- rubocop (>= 1.39, < 2.0)
109
- rubocop-performance (1.18.0)
110
- rubocop (>= 1.7.0, < 2.0)
111
- rubocop-ast (>= 0.4.0)
112
- rubocop-rails (2.20.2)
113
- activesupport (>= 4.2.0)
114
- rack (>= 1.1)
115
- rubocop (>= 1.33.0, < 2.0)
116
- rubocop-rake (0.6.0)
117
- rubocop (~> 1.0)
118
- rubocop-shopify (2.14.0)
119
- rubocop (~> 1.51)
120
- rubocop-sorbet (0.7.0)
121
- rubocop (>= 0.90.0)
122
- rubocop-standard (7.1.0)
123
- rubocop
124
- rubocop-minitest
125
- rubocop-performance
126
- rubocop-rails
127
- rubocop-rake
128
- rubocop-shopify
129
- rubocop-sorbet
130
- ruby-progressbar (1.13.0)
131
- ruby2_keywords (0.0.5)
132
- thor (1.2.2)
133
- tzinfo (2.0.6)
134
- concurrent-ruby (~> 1.0)
135
- unicode-display_width (2.4.2)
136
- webmock (3.18.1)
137
- addressable (>= 2.8.0)
138
- crack (>= 0.3.2)
139
- hashdiff (>= 0.4.0, < 2.0.0)
140
- zeitwerk (2.6.8)
141
-
142
- PLATFORMS
143
- arm64-darwin-22
144
- x86_64-linux
145
-
146
- DEPENDENCIES
147
- amazing_print
148
- debug
149
- minitest (~> 5.18)
150
- mocha (~> 2.0)
151
- rake (~> 13.0)
152
- rubocop (~> 1.6)
153
- rubocop-standard
154
- slack_webhook_logger!
155
- webmock (~> 3.11)
156
-
157
- BUNDLED WITH
158
- 2.2.33