slack_webhook_logger 0.3.1 → 0.4.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: 7b2ea7a93a3ddc68d86ffdfa85b7b9f9694484fc88962f514e36e2319019043c
4
- data.tar.gz: df61448759a8f085ae5693c30f1a5c45e5c6a44a872a8eaf984f6390d11c071c
3
+ metadata.gz: 7946d92f1bd89b5b0abe79a1d1a54566cb83017c2a2b8c96692f918f89274a5f
4
+ data.tar.gz: c74d1d8381ea1b4a2a23781f949ec33d0408e89b7bffcbeb5e621bf10e3e385d
5
5
  SHA512:
6
- metadata.gz: 7464c0106b86d2029d5075cf1220f53cf4f8d0d7d71a55716f20b84388332ff1497d609d2e72ab0fb493609378bf88e34057e40a5ea2b9517b0faa5994e74fa4
7
- data.tar.gz: 90918593ee010f3547f39f6de174739f42ccef225c2435270579473b653bfb5f5d549e19efe6f274c82d057685d14d54f52d2c2713213c90b4b52b1f54ffc506
6
+ metadata.gz: 8b0ae3b2a587b896ae2d55bb5f9ad066354272b05b12eb2e463f7f07c33fbe7a680412166dacc4553faf04c9794cd2dbe29197c80b74cde69c50b2728c3feaca
7
+ data.tar.gz: 0a4363543af0d739112b4c17f5c6647b6a3c280ec933aaff37d78d6b2b95159d625a4ac3fbe82595167c07f0306edbbdcba9f7926312d2ab775412365f8c3d1d
data/.github/FUNDING.yml CHANGED
@@ -1,12 +1,3 @@
1
1
  # These are supported funding model platforms
2
2
 
3
3
  github: gjtorikian
4
- patreon: gjtorikian
5
- open_collective: garen-torikian
6
- #ko_fi: # Replace with a single Ko-fi username
7
- #tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
- #community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
- #liberapay: # Replace with a single Liberapay username
10
- issuehunt: gjtorikian
11
- #otechie: # Replace with a single Otechie username
12
- #custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,5 @@
1
+ {
2
+ "[ruby]": {
3
+ "editor.defaultFormatter": "Shopify.ruby-lsp"
4
+ }
5
+ }
data/Gemfile.lock CHANGED
@@ -1,113 +1,119 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slack_webhook_logger (0.3.1)
4
+ slack_webhook_logger (0.4.0)
5
5
  activesupport (>= 5.0, < 8.0)
6
+ httpx (~> 0.20)
6
7
  railties (>= 5.0, < 8.0)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
10
11
  specs:
11
- actionpack (7.0.0)
12
- actionview (= 7.0.0)
13
- activesupport (= 7.0.0)
12
+ actionpack (7.0.4.3)
13
+ actionview (= 7.0.4.3)
14
+ activesupport (= 7.0.4.3)
14
15
  rack (~> 2.0, >= 2.2.0)
15
16
  rack-test (>= 0.6.3)
16
17
  rails-dom-testing (~> 2.0)
17
18
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
18
- actionview (7.0.0)
19
- activesupport (= 7.0.0)
19
+ actionview (7.0.4.3)
20
+ activesupport (= 7.0.4.3)
20
21
  builder (~> 3.1)
21
22
  erubi (~> 1.4)
22
23
  rails-dom-testing (~> 2.0)
23
24
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
24
- activesupport (7.0.0)
25
+ activesupport (7.0.4.3)
25
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
26
27
  i18n (>= 1.6, < 2)
27
28
  minitest (>= 5.1)
28
29
  tzinfo (~> 2.0)
29
- addressable (2.8.0)
30
- public_suffix (>= 2.0.2, < 5.0)
30
+ addressable (2.8.4)
31
+ public_suffix (>= 2.0.2, < 6.0)
31
32
  ast (2.4.2)
32
33
  awesome_print (1.9.2)
33
34
  builder (3.2.4)
34
- concurrent-ruby (1.1.9)
35
+ concurrent-ruby (1.2.2)
35
36
  crack (0.4.5)
36
37
  rexml
37
38
  crass (1.0.6)
38
- erubi (1.10.0)
39
+ erubi (1.12.0)
39
40
  hashdiff (1.0.1)
40
- i18n (1.8.11)
41
+ http-2-next (0.5.1)
42
+ httpx (0.23.1)
43
+ http-2-next (>= 0.4.1)
44
+ i18n (1.13.0)
41
45
  concurrent-ruby (~> 1.0)
42
- loofah (2.13.0)
46
+ json (2.6.3)
47
+ loofah (2.20.0)
43
48
  crass (~> 1.0.2)
44
49
  nokogiri (>= 1.5.9)
45
50
  method_source (1.0.0)
46
- minitest (5.15.0)
47
- nokogiri (1.12.5-arm64-darwin)
51
+ minitest (5.18.0)
52
+ nokogiri (1.14.3-arm64-darwin)
48
53
  racc (~> 1.4)
49
- parallel (1.21.0)
50
- parser (3.0.3.2)
54
+ parallel (1.23.0)
55
+ parser (3.2.2.1)
51
56
  ast (~> 2.4.1)
52
- public_suffix (4.0.6)
53
- racc (1.6.0)
54
- rack (2.2.3)
55
- rack-test (1.1.0)
56
- rack (>= 1.0, < 3)
57
+ public_suffix (5.0.1)
58
+ racc (1.6.2)
59
+ rack (2.2.7)
60
+ rack-test (2.1.0)
61
+ rack (>= 1.3)
57
62
  rails-dom-testing (2.0.3)
58
63
  activesupport (>= 4.2.0)
59
64
  nokogiri (>= 1.6)
60
- rails-html-sanitizer (1.4.2)
61
- loofah (~> 2.3)
62
- railties (7.0.0)
63
- actionpack (= 7.0.0)
64
- activesupport (= 7.0.0)
65
+ rails-html-sanitizer (1.5.0)
66
+ loofah (~> 2.19, >= 2.19.1)
67
+ railties (7.0.4.3)
68
+ actionpack (= 7.0.4.3)
69
+ activesupport (= 7.0.4.3)
65
70
  method_source
66
71
  rake (>= 12.2)
67
72
  thor (~> 1.0)
68
73
  zeitwerk (~> 2.5)
69
- rainbow (3.0.0)
74
+ rainbow (3.1.1)
70
75
  rake (12.3.3)
71
- regexp_parser (2.2.0)
76
+ regexp_parser (2.8.0)
72
77
  rexml (3.2.5)
73
- rubocop (1.23.0)
78
+ rubocop (1.50.2)
79
+ json (~> 2.3)
74
80
  parallel (~> 1.10)
75
- parser (>= 3.0.0.0)
81
+ parser (>= 3.2.0.0)
76
82
  rainbow (>= 2.2.2, < 4.0)
77
83
  regexp_parser (>= 1.8, < 3.0)
78
- rexml
79
- rubocop-ast (>= 1.12.0, < 2.0)
84
+ rexml (>= 3.2.5, < 4.0)
85
+ rubocop-ast (>= 1.28.0, < 2.0)
80
86
  ruby-progressbar (~> 1.7)
81
- unicode-display_width (>= 1.4.0, < 3.0)
82
- rubocop-ast (1.15.0)
83
- parser (>= 3.0.1.1)
84
- rubocop-minitest (0.17.0)
85
- rubocop (>= 0.90, < 2.0)
86
- rubocop-performance (1.12.0)
87
+ unicode-display_width (>= 2.4.0, < 3.0)
88
+ rubocop-ast (1.28.1)
89
+ parser (>= 3.2.1.0)
90
+ rubocop-minitest (0.30.0)
91
+ rubocop (>= 1.39, < 2.0)
92
+ rubocop-performance (1.17.1)
87
93
  rubocop (>= 1.7.0, < 2.0)
88
94
  rubocop-ast (>= 0.4.0)
89
- rubocop-rails (2.12.4)
95
+ rubocop-rails (2.19.1)
90
96
  activesupport (>= 4.2.0)
91
97
  rack (>= 1.1)
92
- rubocop (>= 1.7.0, < 2.0)
98
+ rubocop (>= 1.33.0, < 2.0)
93
99
  rubocop-rake (0.6.0)
94
100
  rubocop (~> 1.0)
95
- rubocop-standard (5.1.2)
101
+ rubocop-standard (5.2.1)
96
102
  rubocop
97
103
  rubocop-minitest
98
104
  rubocop-performance
99
105
  rubocop-rails
100
106
  rubocop-rake
101
- ruby-progressbar (1.11.0)
102
- thor (1.1.0)
103
- tzinfo (2.0.4)
107
+ ruby-progressbar (1.13.0)
108
+ thor (1.2.1)
109
+ tzinfo (2.0.6)
104
110
  concurrent-ruby (~> 1.0)
105
- unicode-display_width (2.1.0)
106
- webmock (3.14.0)
111
+ unicode-display_width (2.4.2)
112
+ webmock (3.18.1)
107
113
  addressable (>= 2.8.0)
108
114
  crack (>= 0.3.2)
109
115
  hashdiff (>= 0.4.0, < 2.0.0)
110
- zeitwerk (2.5.1)
116
+ zeitwerk (2.6.8)
111
117
 
112
118
  PLATFORMS
113
119
  ruby
@@ -21,7 +21,7 @@ module SlackWebhookLogger
21
21
  '🪵 *Logger*'
22
22
  end
23
23
 
24
- title = "#{heading} (#{time}) [#{ENV['RAILS_ENV']}]"
24
+ title = "#{heading} (#{time}) [#{ENV.fetch('RAILS_ENV', nil)}]"
25
25
 
26
26
  text = <<~MSG
27
27
  #{msg2str(msg)}
@@ -5,7 +5,7 @@ require 'active_support/core_ext/module/delegation'
5
5
  module SlackWebhookLogger
6
6
  class Logger < ::ActiveSupport::Logger
7
7
  class << self
8
- delegate :fatal, :error, :warn, :info, :debug, \
8
+ delegate :fatal, :error, :warn, :info, :debug,
9
9
  :add, :log, to: :instance
10
10
  end
11
11
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'uri'
4
4
  require 'json'
5
+ require 'httpx'
5
6
 
6
7
  module SlackWebhookLogger
7
8
  class RequestIO
@@ -14,11 +15,7 @@ module SlackWebhookLogger
14
15
 
15
16
  return if SlackWebhookLogger.ignore_patterns.any? { |ignore_pattern| hash[:text].match(ignore_pattern) }
16
17
 
17
- payload = hash.to_json
18
-
19
- req = Net::HTTP::Post.new(SlackWebhookLogger.webhook_uri.path)
20
- req.set_form_data(payload: payload)
21
- SlackWebhookLogger.https.request(req)
18
+ HTTPX.post(SlackWebhookLogger.webhook_uri.to_s, form: hash)
22
19
  end
23
20
  end
24
21
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SlackWebhookLogger
4
- VERSION = '0.3.1'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -32,12 +32,11 @@ module SlackWebhookLogger
32
32
  @@logger.formatter = @@formatter || SlackWebhookLogger::Formatter.new
33
33
  @@logger.level = @@level || :warn
34
34
 
35
- @@webhook_uri = URI.parse(@@webhook_url)
36
- https = Net::HTTP.new(@@webhook_uri.host, @@webhook_uri.port)
37
- https.use_ssl = true
38
- https.verify_mode = OpenSSL::SSL::VERIFY_PEER
39
-
40
- @@https = https
35
+ begin
36
+ @@webhook_uri = URI.parse(@@webhook_url)
37
+ rescue URI::InvalidURIError
38
+ raise ArgumentError, 'Invalid URI for webhook_url'
39
+ end
41
40
 
42
41
  @@ignore_patterns ||= []
43
42
  end
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = ['lib']
26
26
 
27
27
  spec.add_dependency 'activesupport', '>= 5.0', '< 8.0'
28
+ spec.add_dependency 'httpx', '~> 0.20'
28
29
  spec.add_dependency 'railties', '>= 5.0', '< 8.0' # for the generators
29
30
  spec.metadata = {
30
31
  'rubygems_mfa_required' => 'true'
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.3.1
4
+ version: 0.4.0
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: 2021-12-19 00:00:00.000000000 Z
11
+ date: 2023-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '8.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: httpx
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.20'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.20'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: railties
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -62,6 +76,7 @@ files:
62
76
  - ".github/workflows/lint.yml"
63
77
  - ".gitignore"
64
78
  - ".rubocop.yml"
79
+ - ".vscode/settings.json"
65
80
  - CODE_OF_CONDUCT.md
66
81
  - Gemfile
67
82
  - Gemfile.lock
@@ -98,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
113
  - !ruby/object:Gem::Version
99
114
  version: '0'
100
115
  requirements: []
101
- rubygems_version: 3.2.33
116
+ rubygems_version: 3.4.12
102
117
  signing_key:
103
118
  specification_version: 4
104
119
  summary: A slim wrapper for posting to Rails logs to Slack