smart_todo 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- 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 +16 -14
- data/dev.yml +1 -1
- data/lib/smart_todo/slack_client.rb +18 -23
- data/lib/smart_todo/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7cac40289c5fb2fdf4bb143ee7cca9b1c74ce41c7e1fa426f7efc17364a2683
|
4
|
+
data.tar.gz: c93946f4131f64068e9c249c760829a33f3e88ae669f322bb00ea0647f68eb20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6a84fd8bd731f7b31fe0033be57a50ba018af724ae29cfa16a4c9a0a96766e6335ee1c1145976002519aff1f69d6a28a3bf220963e42f55c28b051f02c85d80
|
7
|
+
data.tar.gz: 562151dd8c4fc2b8d55d72c004a701ef2c10f01d3e84f632b1a945ee969469e7dffd5473c7f109548ca105175b1a893f1e039a9ee091b3cb8034af7e47116082
|
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,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smart_todo (1.
|
4
|
+
smart_todo (1.8.0)
|
5
5
|
prism (~> 0.15)
|
6
6
|
|
7
7
|
GEM
|
@@ -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
23
|
prism (0.17.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
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.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prism
|
@@ -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
|
@@ -147,7 +148,7 @@ 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
|
+
rubygems_version: 3.5.13
|
151
152
|
signing_key:
|
152
153
|
specification_version: 4
|
153
154
|
summary: Enhance todo's comments in your codebase.
|