chat_sdk-slack 0.1.0 → 0.2.1
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/lib/chat_sdk/slack/adapter.rb +12 -19
- data/lib/chat_sdk/slack/event_parser.rb +0 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0cd81973afe132c9e2eeb80889ae3536dcc7f3b37afd6d1094e4d96ee1e0b774
|
|
4
|
+
data.tar.gz: e75c3ac11358aaafe1db5e7f0e1a9b80cb77119f177e67787fa41bd36f35c5d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7a1fc0923a33ae633d56e39e490741b6fa175ada67b17451fe25d035ebdb9cd1c33323633fddd792fef7c1a3e6ee9ff5409c7c8ebc383026355dd54075491ed5
|
|
7
|
+
data.tar.gz: 8c9dcbe4c7639f34c229f4600abdacbffe8d1c8b05020a6cc5b6d136ed6caed0c4ca834dae8942c9f7760a3bfc25affe9cbc5f47b3a31e36ef8645555fe0e802
|
|
@@ -82,13 +82,7 @@ module ChatSDK
|
|
|
82
82
|
params = {channel: channel_id}
|
|
83
83
|
params[:thread_ts] = thread_id if thread_id
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
rendered = @renderer.render(msg.card)
|
|
87
|
-
params[:blocks] = rendered
|
|
88
|
-
params[:text] = msg.text || msg.card.fallback_text
|
|
89
|
-
else
|
|
90
|
-
params[:text] = msg.text
|
|
91
|
-
end
|
|
85
|
+
apply_message_params(params, msg)
|
|
92
86
|
|
|
93
87
|
result = @client.chat_postMessage(**params)
|
|
94
88
|
|
|
@@ -107,12 +101,7 @@ module ChatSDK
|
|
|
107
101
|
msg = ChatSDK::PostableMessage.from(message)
|
|
108
102
|
params = {channel: channel_id, ts: message_id}
|
|
109
103
|
|
|
110
|
-
|
|
111
|
-
params[:blocks] = @renderer.render(msg.card)
|
|
112
|
-
params[:text] = msg.text || msg.card.fallback_text
|
|
113
|
-
else
|
|
114
|
-
params[:text] = msg.text
|
|
115
|
-
end
|
|
104
|
+
apply_message_params(params, msg)
|
|
116
105
|
|
|
117
106
|
@client.chat_update(**params)
|
|
118
107
|
end
|
|
@@ -126,12 +115,7 @@ module ChatSDK
|
|
|
126
115
|
params = {channel: channel_id, user: user_id}
|
|
127
116
|
params[:thread_ts] = thread_id if thread_id
|
|
128
117
|
|
|
129
|
-
|
|
130
|
-
params[:blocks] = @renderer.render(msg.card)
|
|
131
|
-
params[:text] = msg.text || msg.card.fallback_text
|
|
132
|
-
else
|
|
133
|
-
params[:text] = msg.text
|
|
134
|
-
end
|
|
118
|
+
apply_message_params(params, msg)
|
|
135
119
|
|
|
136
120
|
@client.chat_postEphemeral(**params)
|
|
137
121
|
end
|
|
@@ -190,6 +174,15 @@ module ChatSDK
|
|
|
190
174
|
|
|
191
175
|
private
|
|
192
176
|
|
|
177
|
+
def apply_message_params(params, msg)
|
|
178
|
+
if msg.card?
|
|
179
|
+
params[:blocks] = @renderer.render(msg.card)
|
|
180
|
+
params[:text] = msg.text || msg.card.fallback_text
|
|
181
|
+
else
|
|
182
|
+
params[:text] = msg.text
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
193
186
|
def parse_body(body, content_type)
|
|
194
187
|
if content_type&.include?("application/json")
|
|
195
188
|
JSON.parse(body)
|