smart_todo 1.3.0 → 1.3.1
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 +2 -2
- data/Gemfile.lock +1 -1
- data/dev.yml +5 -1
- data/lib/smart_todo/dispatchers/output.rb +1 -1
- data/lib/smart_todo/slack_client.rb +10 -9
- data/lib/smart_todo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc3a4665a0110180692321fbdd788be8df4155de16bf75b2967f4c330a759e72
|
4
|
+
data.tar.gz: 414a198aa06035126890b002f6552779c73d9f6f84eeeaa904ba2132daa7d4d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e0c57b0849a90cd1be9699d264167e7286d622eb42e02cc7dd13231ab41d76d815a455a65571f3890dda7c79dc0228692b0c72c37c50337826df137d0c0f0df
|
7
|
+
data.tar.gz: a62b94332abe655cb418d0238eaa24e86db0e48b109877b8192265a244795624a2188cffeb0be429f0204683394b992ce73a0932efc322b4c3ba589cadcd0af4
|
data/.github/workflows/build.yml
CHANGED
data/Gemfile.lock
CHANGED
data/dev.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "cgi"
|
3
4
|
require "net/http"
|
4
5
|
require "json"
|
5
6
|
|
@@ -37,14 +38,14 @@ module SmartTodo
|
|
37
38
|
# @param email [String]
|
38
39
|
# @return [Hash]
|
39
40
|
#
|
40
|
-
# @raise [Net::HTTPError] in case the
|
41
|
-
# @raise [SlackClient::Error] in case Slack
|
41
|
+
# @raise [Net::HTTPError] in case the request to Slack failed
|
42
|
+
# @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body
|
42
43
|
#
|
43
44
|
# @see https://api.slack.com/methods/users.lookupByEmail
|
44
45
|
def lookup_user_by_email(email)
|
45
46
|
headers = { "Content-Type" => "application/x-www-form-urlencoded" }
|
46
47
|
|
47
|
-
request(:get, "/api/users.lookupByEmail?email=#{email}", nil, headers)
|
48
|
+
request(:get, "/api/users.lookupByEmail?email=#{CGI.escape(email)}", nil, headers)
|
48
49
|
end
|
49
50
|
|
50
51
|
# Send a message to a Slack channel or to a user
|
@@ -53,8 +54,8 @@ module SmartTodo
|
|
53
54
|
# @param text [String] The message to send
|
54
55
|
# @return [Hash]
|
55
56
|
#
|
56
|
-
# @raise [Net::HTTPError] in case the
|
57
|
-
# @raise [SlackClient::Error] in case Slack
|
57
|
+
# @raise [Net::HTTPError] in case the request to Slack failed
|
58
|
+
# @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body
|
58
59
|
#
|
59
60
|
# @see https://api.slack.com/methods/chat.postMessage
|
60
61
|
def post_message(channel, text)
|
@@ -68,8 +69,8 @@ module SmartTodo
|
|
68
69
|
# @param data [String] JSON encoded data when making a POST request
|
69
70
|
# @param headers [Hash]
|
70
71
|
#
|
71
|
-
# @raise [Net::HTTPError] in case the
|
72
|
-
# @raise [SlackClient::Error] in case Slack
|
72
|
+
# @raise [Net::HTTPError] in case the request to Slack failed
|
73
|
+
# @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body
|
73
74
|
def request(method, endpoint, data = nil, headers = {})
|
74
75
|
response = case method
|
75
76
|
when :post, :patch
|
@@ -87,8 +88,8 @@ module SmartTodo
|
|
87
88
|
# (Net::HTTPOK, Net::HTTPNotFound ...)
|
88
89
|
# @return [Hash]
|
89
90
|
#
|
90
|
-
# @raise [Net::HTTPError] in case the
|
91
|
-
# @raise [SlackClient::Error] in case Slack
|
91
|
+
# @raise [Net::HTTPError] in case the request to Slack failed
|
92
|
+
# @raise [SlackClient::Error] in case Slack returns a { ok: false } in the body
|
92
93
|
def slack_response!(response)
|
93
94
|
raise(Net::HTTPError.new("Request to slack failed", response)) unless response.code_type < Net::HTTPSuccess
|
94
95
|
body = JSON.parse(response.body)
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shopify
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rexml
|