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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6e4e9dd2243b38d51bcdd10278e9f59ac540e01f7340ece7585d63475c59e06
4
- data.tar.gz: 2f7a0a47486dcfa63cd3be0c4784ba70f5d8f973beed2b276b4ce10aebb5a242
3
+ metadata.gz: 0cd81973afe132c9e2eeb80889ae3536dcc7f3b37afd6d1094e4d96ee1e0b774
4
+ data.tar.gz: e75c3ac11358aaafe1db5e7f0e1a9b80cb77119f177e67787fa41bd36f35c5d3
5
5
  SHA512:
6
- metadata.gz: c1d6bc38dc2635d2e737c915f2eb24c32c16f0c9ed7792af675769ddebbe3e14de8b679c28566ca9e5655b4332860a58424aa5bff6901eaa3120baf17051c80b
7
- data.tar.gz: 9f3af6fb31887b727e0ff1b9bbfcabdb57e9dc1008b915f4b25ae13a7ef22c794ea5042a42d7117c31b990233dfdc69de819e642d55b581f57dfa2d3b7fb80f4
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
- if msg.card?
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
- if msg.card?
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
- if msg.card?
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)
@@ -12,8 +12,6 @@ module ChatSDK
12
12
  parse_block_actions(payload)
13
13
  when "view_submission"
14
14
  parse_view_submission(payload)
15
- when "slash_commands"
16
- parse_slash_command(payload)
17
15
  else
18
16
  # Slash commands come as form-encoded, not wrapped in type
19
17
  if payload["command"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chat_sdk-slack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rootly