Module: Slack::Web::Api::Endpoints::Chat
- Included in:
- Slack::Web::Api::Endpoints
- Defined in:
- lib/slack/web/api/endpoints/chat.rb
Instance Method Summary collapse
-
#chat_delete(options = {}) ⇒ Object
Deletes a message.
-
#chat_meMessage(options = {}) ⇒ Object
Share a me message into a channel.
-
#chat_postEphemeral(options = {}) ⇒ Object
Sends an ephemeral message to a user in a channel.
-
#chat_postMessage(options = {}) ⇒ Object
Sends a message to a channel.
-
#chat_unfurl(options = {}) ⇒ Object
Provide custom unfurl behavior for user-posted URLs.
-
#chat_update(options = {}) ⇒ Object
Updates a message.
Instance Method Details
#chat_delete(options = {}) ⇒ Object
Deletes a message.
19 20 21 22 23 24 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 19 def chat_delete( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('chat.delete', ) end |
#chat_meMessage(options = {}) ⇒ Object
Share a me message into a channel.
35 36 37 38 39 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 35 def chat_meMessage( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text missing') if [:text].nil? post('chat.meMessage', ) end |
#chat_postEphemeral(options = {}) ⇒ Object
Sends an ephemeral message to a user in a channel.
60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 60 def chat_postEphemeral( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text missing') if [:text].nil? throw ArgumentError.new('Required arguments :user missing') if [:user].nil? = .merge(user: users_id()['user']['id']) if [:user] # attachments must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end post('chat.postEphemeral', ) end |
#chat_postMessage(options = {}) ⇒ Object
Sends a message to a channel.
105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 105 def chat_postMessage( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text or :attachments missing') if [:text].nil? && [:attachments].nil? # attachments must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end post('chat.postMessage', ) end |
#chat_unfurl(options = {}) ⇒ Object
Provide custom unfurl behavior for user-posted URLs
134 135 136 137 138 139 140 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 134 def chat_unfurl( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? throw ArgumentError.new('Required arguments :unfurls missing') if [:unfurls].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] post('chat.unfurl', ) end |
#chat_update(options = {}) ⇒ Object
Updates a message.
161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/slack/web/api/endpoints/chat.rb', line 161 def chat_update( = {}) throw ArgumentError.new('Required arguments :channel missing') if [:channel].nil? throw ArgumentError.new('Required arguments :text or :attachments missing') if [:text].nil? && [:attachments].nil? throw ArgumentError.new('Required arguments :ts missing') if [:ts].nil? = .merge(channel: channels_id()['channel']['id']) if [:channel] # attachments must be passed as an encoded JSON string if .key?(:attachments) = [:attachments] = JSON.dump() unless .is_a?(String) = .merge(attachments: ) end post('chat.update', ) end |