smart_todo 1.7.0 → 1.9.0

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: 7bbca316fba93242bc5ea22479579407ed9ce3ed93a6bd618978223f96f0626d
4
- data.tar.gz: c91cf35475f5a32da647f6ed649ac7d50d85a929908aa29f1768a9b1d6db75da
3
+ metadata.gz: 170d33c5c9e48fbfe0ee1507a0f3f2ead41a6c931f25730205e62451cabe4eec
4
+ data.tar.gz: 1f549b5af2613e3ea18cb42e00c01c97edf2d0f48ccf0b25d47a4695798ce945
5
5
  SHA512:
6
- metadata.gz: 1668111d5578d6c64f2ff7df6071f9ede6ccc4aeb01bf1c5cdccea8d514cf29caad0b2b576bb3bb60eaaaa309f44b723e066c62b39b50ab17e418372a29c4dad
7
- data.tar.gz: 25636e700c032b2bc0509791f8884f9e9f6cb78ae09103db503d69739e48507c07c8a8fc6579f4f441c1f08caf09f19274ad19061305b9ad9b82efc5c41e9711
6
+ metadata.gz: f51affefbc4906000a4e767d8d610f609e627a51258ae249b186e231e67e531d165fa03a0a7385e50b7ef8d96ea3f990c7cc98f42cb1519f2d94f82f24c54e72
7
+ data.tar.gz: a4d608772b81419a7c5d46a14b11ed4b862ce5f22c67c39d64dca9b1aa8c54a88e6e5256c5527ca5b9bb940dd9c5fd565ca9cca42566383b1f27c9c1ee692d61
@@ -12,7 +12,7 @@ jobs:
12
12
  name: Ruby ${{ matrix.version }}
13
13
  strategy:
14
14
  matrix:
15
- version: [3.0, 3.1, 3.2]
15
+ version: [3.0, 3.1, 3.2, 3.3]
16
16
 
17
17
  steps:
18
18
  - uses: actions/checkout@v2
@@ -8,10 +8,9 @@ jobs:
8
8
 
9
9
  steps:
10
10
  - uses: actions/checkout@v2
11
- - name: Set up Ruby 3.0
11
+ - name: Set up Ruby
12
12
  uses: ruby/setup-ruby@v1
13
13
  with:
14
- ruby-version: 3.0
15
14
  bundler-cache: true
16
15
  - name: Install gems
17
16
  run: |
data/.rubocop.yml CHANGED
@@ -2,7 +2,6 @@ inherit_gem:
2
2
  rubocop-shopify: rubocop.yml
3
3
 
4
4
  AllCops:
5
- TargetRubyVersion: 3.0
6
5
  NewCops: disable
7
6
  SuggestExtensions: false
8
7
  Exclude:
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.3.0
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_todo (1.7.0)
5
- prism (~> 0.15)
4
+ smart_todo (1.9.0)
5
+ prism (~> 1.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
@@ -13,35 +13,37 @@ GEM
13
13
  crack (0.4.5)
14
14
  rexml
15
15
  hashdiff (1.0.1)
16
- json (2.6.3)
16
+ json (2.7.1)
17
+ language_server-protocol (3.17.0.3)
17
18
  minitest (5.14.4)
18
- parallel (1.23.0)
19
- parser (3.2.2.3)
19
+ parallel (1.24.0)
20
+ parser (3.3.0.5)
20
21
  ast (~> 2.4.1)
21
22
  racc
22
- prism (0.17.0)
23
+ prism (1.0.0)
23
24
  public_suffix (4.0.6)
24
- racc (1.7.0)
25
+ racc (1.7.3)
25
26
  rainbow (3.1.1)
26
27
  rake (13.0.6)
27
- regexp_parser (2.8.1)
28
- rexml (3.2.5)
29
- rubocop (1.52.1)
28
+ regexp_parser (2.9.0)
29
+ rexml (3.2.6)
30
+ rubocop (1.62.1)
30
31
  json (~> 2.3)
32
+ language_server-protocol (>= 3.17.0)
31
33
  parallel (~> 1.10)
32
- parser (>= 3.2.2.3)
34
+ parser (>= 3.3.0.2)
33
35
  rainbow (>= 2.2.2, < 4.0)
34
36
  regexp_parser (>= 1.8, < 3.0)
35
37
  rexml (>= 3.2.5, < 4.0)
36
- rubocop-ast (>= 1.28.0, < 2.0)
38
+ rubocop-ast (>= 1.31.1, < 2.0)
37
39
  ruby-progressbar (~> 1.7)
38
40
  unicode-display_width (>= 2.4.0, < 3.0)
39
- rubocop-ast (1.29.0)
40
- parser (>= 3.2.1.0)
41
+ rubocop-ast (1.31.2)
42
+ parser (>= 3.3.0.4)
41
43
  rubocop-shopify (2.14.0)
42
44
  rubocop (~> 1.51)
43
45
  ruby-progressbar (1.13.0)
44
- unicode-display_width (2.4.2)
46
+ unicode-display_width (2.5.0)
45
47
  webmock (3.11.2)
46
48
  addressable (>= 2.3.6)
47
49
  crack (>= 0.3.2)
@@ -59,4 +61,4 @@ DEPENDENCIES
59
61
  webmock
60
62
 
61
63
  BUNDLED WITH
62
- 2.2.25
64
+ 2.5.7
data/dev.yml CHANGED
@@ -4,7 +4,7 @@ type:
4
4
  - ruby
5
5
 
6
6
  up:
7
- - ruby: 3.0.2
7
+ - ruby
8
8
  - bundler
9
9
 
10
10
  console:
@@ -39,9 +39,9 @@ module SmartTodo
39
39
  #
40
40
  # @see https://api.slack.com/methods/users.lookupByEmail
41
41
  def lookup_user_by_email(email)
42
- headers = { "Content-Type" => "application/x-www-form-urlencoded" }
43
-
44
- request(:get, "/api/users.lookupByEmail?email=#{CGI.escape(email)}", nil, headers)
42
+ headers = default_headers.merge("Content-Type" => "application/x-www-form-urlencoded")
43
+ request = Net::HTTP::Get.new("/api/users.lookupByEmail?email=#{CGI.escape(email)}", headers)
44
+ dispatch(request)
45
45
  end
46
46
 
47
47
  # Send a message to a Slack channel or to a user
@@ -55,7 +55,10 @@ module SmartTodo
55
55
  #
56
56
  # @see https://api.slack.com/methods/chat.postMessage
57
57
  def post_message(channel, text)
58
- request(:post, "/api/chat.postMessage", JSON.dump(channel: channel, text: text))
58
+ headers = default_headers
59
+ request = Net::HTTP::Post.new("/api/chat.postMessage", headers)
60
+ request.body = JSON.dump(channel: channel, text: text)
61
+ dispatch(request)
59
62
  end
60
63
 
61
64
  private
@@ -67,27 +70,19 @@ module SmartTodo
67
70
  #
68
71
  # @raise [Net::HTTPError] in case the request to Slack failed
69
72
  # @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body
70
- def request(method, endpoint, data = nil, headers = {})
71
- response = case method
72
- when :post, :patch
73
- @client.public_send(method, endpoint, data, default_headers.merge(headers))
74
- else
75
- @client.public_send(method, endpoint, default_headers.merge(headers))
76
- end
73
+ def dispatch(request, max_attempts = 5)
74
+ response = @client.request(request)
75
+ attempts = 1
77
76
 
78
- slack_response!(response)
79
- end
77
+ while response.is_a?(Net::HTTPTooManyRequests) && attempts < max_attempts
78
+ sleep([Integer(response["Retry-After"]), 600].min)
79
+ response = @client.request(request)
80
+ attempts += 1
81
+ end
80
82
 
81
- # Check if the response to Slack was a 200 and the Slack API request was successful
82
- #
83
- # @param response [Net::HTTPResponse] a net Net::HTTPResponse subclass
84
- # (Net::HTTPOK, Net::HTTPNotFound ...)
85
- # @return [Hash]
86
- #
87
- # @raise [Net::HTTPError] in case the request to Slack failed
88
- # @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body
89
- def slack_response!(response)
90
- raise(Net::HTTPError.new("Request to slack failed", response)) unless response.code_type < Net::HTTPSuccess
83
+ unless response.code_type < Net::HTTPSuccess
84
+ raise(Net::HTTPError.new("Request to slack failed", response))
85
+ end
91
86
 
92
87
  body = JSON.parse(response.body)
93
88
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SmartTodo
4
- VERSION = "1.7.0"
4
+ VERSION = "1.9.0"
5
5
  end
data/smart_todo.gemspec CHANGED
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.executables = ["smart_todo"]
34
34
  spec.require_paths = ["lib"]
35
35
 
36
- spec.add_runtime_dependency("prism", "~> 0.15")
36
+ spec.add_runtime_dependency("prism", "~> 1.0")
37
37
  spec.add_development_dependency("bundler", ">= 1.17")
38
38
  spec.add_development_dependency("minitest", "~> 5.0")
39
39
  spec.add_development_dependency("rake", ">= 10.0")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_todo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-08 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prism
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.15'
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.15'
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -97,6 +97,7 @@ files:
97
97
  - ".github/workflows/rubocop.yml"
98
98
  - ".gitignore"
99
99
  - ".rubocop.yml"
100
+ - ".ruby-version"
100
101
  - CODE_OF_CONDUCT.md
101
102
  - Gemfile
102
103
  - Gemfile.lock
@@ -132,7 +133,7 @@ metadata:
132
133
  source_code_uri: https://github.com/shopify/smart_todo
133
134
  changelog_uri: https://github.com/shopify/smart_todo/releases
134
135
  allowed_push_host: https://rubygems.org
135
- post_install_message:
136
+ post_install_message:
136
137
  rdoc_options: []
137
138
  require_paths:
138
139
  - lib
@@ -147,8 +148,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
148
  - !ruby/object:Gem::Version
148
149
  version: '0'
149
150
  requirements: []
150
- rubygems_version: 3.4.22
151
- signing_key:
151
+ rubygems_version: 3.5.17
152
+ signing_key:
152
153
  specification_version: 4
153
154
  summary: Enhance todo's comments in your codebase.
154
155
  test_files: []