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 +4 -4
- data/.github/workflows/build.yml +1 -1
- data/.github/workflows/rubocop.yml +1 -2
- data/.rubocop.yml +0 -1
- data/.ruby-version +1 -0
- data/Gemfile.lock +18 -16
- data/dev.yml +1 -1
- data/lib/smart_todo/slack_client.rb +18 -23
- data/lib/smart_todo/version.rb +1 -1
- data/smart_todo.gemspec +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 170d33c5c9e48fbfe0ee1507a0f3f2ead41a6c931f25730205e62451cabe4eec
|
4
|
+
data.tar.gz: 1f549b5af2613e3ea18cb42e00c01c97edf2d0f48ccf0b25d47a4695798ce945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f51affefbc4906000a4e767d8d610f609e627a51258ae249b186e231e67e531d165fa03a0a7385e50b7ef8d96ea3f990c7cc98f42cb1519f2d94f82f24c54e72
|
7
|
+
data.tar.gz: a4d608772b81419a7c5d46a14b11ed4b862ce5f22c67c39d64dca9b1aa8c54a88e6e5256c5527ca5b9bb940dd9c5fd565ca9cca42566383b1f27c9c1ee692d61
|
data/.github/workflows/build.yml
CHANGED
data/.rubocop.yml
CHANGED
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.
|
5
|
-
prism (~> 0
|
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.
|
16
|
+
json (2.7.1)
|
17
|
+
language_server-protocol (3.17.0.3)
|
17
18
|
minitest (5.14.4)
|
18
|
-
parallel (1.
|
19
|
-
parser (3.
|
19
|
+
parallel (1.24.0)
|
20
|
+
parser (3.3.0.5)
|
20
21
|
ast (~> 2.4.1)
|
21
22
|
racc
|
22
|
-
prism (0.
|
23
|
+
prism (1.0.0)
|
23
24
|
public_suffix (4.0.6)
|
24
|
-
racc (1.7.
|
25
|
+
racc (1.7.3)
|
25
26
|
rainbow (3.1.1)
|
26
27
|
rake (13.0.6)
|
27
|
-
regexp_parser (2.
|
28
|
-
rexml (3.2.
|
29
|
-
rubocop (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.
|
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.
|
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.
|
40
|
-
parser (>= 3.
|
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.
|
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.
|
64
|
+
2.5.7
|
data/dev.yml
CHANGED
@@ -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 =
|
43
|
-
|
44
|
-
request
|
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
|
-
|
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
|
71
|
-
response =
|
72
|
-
|
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
|
-
|
79
|
-
|
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
|
-
|
82
|
-
|
83
|
-
|
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
|
|
data/lib/smart_todo/version.rb
CHANGED
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
|
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.
|
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:
|
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
|
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
|
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.
|
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: []
|