slack-ruby-client 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -8
  3. data/CHANGELOG.md +4 -0
  4. data/README.md +1 -1
  5. data/bin/commands.rb +1 -0
  6. data/bin/commands/api.rb +2 -2
  7. data/bin/commands/apps_permissions.rb +22 -0
  8. data/bin/commands/auth.rb +4 -4
  9. data/bin/commands/bots.rb +2 -2
  10. data/bin/commands/channels.rb +31 -31
  11. data/bin/commands/chat.rb +40 -23
  12. data/bin/commands/dnd.rb +8 -8
  13. data/bin/commands/emoji.rb +2 -2
  14. data/bin/commands/files.rb +17 -17
  15. data/bin/commands/files_comments.rb +6 -6
  16. data/bin/commands/groups.rb +36 -35
  17. data/bin/commands/im.rb +13 -13
  18. data/bin/commands/mpim.rb +11 -11
  19. data/bin/commands/oauth.rb +15 -2
  20. data/bin/commands/pins.rb +6 -6
  21. data/bin/commands/reactions.rb +13 -13
  22. data/bin/commands/reminders.rb +10 -10
  23. data/bin/commands/rtm.rb +10 -6
  24. data/bin/commands/search.rb +9 -9
  25. data/bin/commands/stars.rb +8 -8
  26. data/bin/commands/team.rb +10 -10
  27. data/bin/commands/team_profile.rb +2 -2
  28. data/bin/commands/usergroups.rb +16 -16
  29. data/bin/commands/usergroups_users.rb +4 -4
  30. data/bin/commands/users.rb +20 -18
  31. data/bin/commands/users_profile.rb +7 -7
  32. data/lib/slack/real_time/stores/starter.rb +20 -0
  33. data/lib/slack/real_time/stores/store.rb +20 -0
  34. data/lib/slack/version.rb +1 -1
  35. data/lib/slack/web/api/endpoints.rb +2 -0
  36. data/lib/slack/web/api/endpoints/api.rb +1 -1
  37. data/lib/slack/web/api/endpoints/apps_permissions.rb +35 -0
  38. data/lib/slack/web/api/endpoints/auth.rb +2 -2
  39. data/lib/slack/web/api/endpoints/bots.rb +1 -1
  40. data/lib/slack/web/api/endpoints/channels.rb +17 -18
  41. data/lib/slack/web/api/endpoints/chat.rb +67 -30
  42. data/lib/slack/web/api/endpoints/dnd.rb +4 -4
  43. data/lib/slack/web/api/endpoints/emoji.rb +1 -1
  44. data/lib/slack/web/api/endpoints/files.rb +16 -17
  45. data/lib/slack/web/api/endpoints/files_comments.rb +8 -8
  46. data/lib/slack/web/api/endpoints/groups.rb +21 -22
  47. data/lib/slack/web/api/endpoints/im.rb +8 -10
  48. data/lib/slack/web/api/endpoints/mpim.rb +7 -9
  49. data/lib/slack/web/api/endpoints/oauth.rb +23 -2
  50. data/lib/slack/web/api/endpoints/pins.rb +3 -5
  51. data/lib/slack/web/api/endpoints/reactions.rb +14 -16
  52. data/lib/slack/web/api/endpoints/reminders.rb +5 -5
  53. data/lib/slack/web/api/endpoints/rtm.rb +14 -6
  54. data/lib/slack/web/api/endpoints/search.rb +9 -9
  55. data/lib/slack/web/api/endpoints/stars.rb +7 -9
  56. data/lib/slack/web/api/endpoints/team.rb +8 -9
  57. data/lib/slack/web/api/endpoints/team_profile.rb +1 -1
  58. data/lib/slack/web/api/endpoints/usergroups.rb +17 -17
  59. data/lib/slack/web/api/endpoints/usergroups_users.rb +2 -2
  60. data/lib/slack/web/api/endpoints/users.rb +15 -15
  61. data/lib/slack/web/api/endpoints/users_profile.rb +8 -8
  62. data/lib/slack/web/api/patches/chat.3.update-attachments-support.patch +4 -3
  63. data/lib/slack/web/api/patches/chat.4.postEphemeral-attachments-support.patch +17 -0
  64. data/spec/integration/integration_spec.rb +1 -1
  65. data/spec/slack/web/api/endpoints/apps_permissions_spec.rb +15 -0
  66. data/spec/slack/web/api/endpoints/custom_specs/chat_spec.rb +37 -1
  67. data/spec/slack/web/api/endpoints/files_comments_spec.rb +8 -8
  68. data/spec/slack/web/api/endpoints/files_spec.rb +0 -5
  69. data/spec/slack/web/api/endpoints/oauth_spec.rb +11 -0
  70. metadata +7 -2
@@ -2,22 +2,22 @@
2
2
 
3
3
  desc 'UsersProfile methods.'
4
4
  command 'users_profile' do |g|
5
- g.desc "Use this method to retrieve a user's profile information."
6
- g.long_desc %( Use this method to retrieve a user's profile information. )
5
+ g.desc "Retrieves a user's profile information."
6
+ g.long_desc %( Retrieves a user's profile information. )
7
7
  g.command 'get' do |c|
8
- c.flag 'user', desc: 'User to retrieve profile info for.'
9
8
  c.flag 'include_labels', desc: 'Include labels for each ID in custom profile fields.'
9
+ c.flag 'user', desc: 'User to retrieve profile info for.'
10
10
  c.action do |_global_options, options, _args|
11
11
  puts JSON.dump($client.users_profile_get(options))
12
12
  end
13
13
  end
14
14
 
15
- g.desc "Use this method to set a user's profile information, including name, email, current status, and other attributes."
16
- g.long_desc %( Use this method to set a user's profile information, including name, email, current status, and other attributes. )
15
+ g.desc 'Set the profile information for a user.'
16
+ g.long_desc %( Set the profile information for a user. )
17
17
  g.command 'set' do |c|
18
- c.flag 'user', desc: 'ID of user to change. This argument may only be specified by team admins on paid teams.'
19
- c.flag 'profile', desc: 'Collection of key:value pairs presented as a URL-encoded JSON hash.'
20
18
  c.flag 'name', desc: 'Name of a single key to set. Usable only if profile is not passed.'
19
+ c.flag 'profile', desc: 'Collection of key:value pairs presented as a URL-encoded JSON hash.'
20
+ c.flag 'user', desc: 'ID of user to change. This argument may only be specified by team admins on paid teams.'
21
21
  c.flag 'value', desc: 'Value to set a single key to. Usable only if profile is not passed.'
22
22
  c.action do |_global_options, options, _args|
23
23
  puts JSON.dump($client.users_profile_set(options))
@@ -14,6 +14,26 @@ module Slack
14
14
 
15
15
  ### RealTime Events
16
16
 
17
+ # The membership of an existing User Group has changed.
18
+ # @see https://api.slack.com/events/subteam_members_changed
19
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_members_changed.json
20
+ # on :subteam_members_changed do |data|
21
+
22
+ # Subscribe to presence events for the specified users.
23
+ # @see https://api.slack.com/events/presence_sub
24
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/presence_sub.json
25
+ # on :presence_sub do |data|
26
+
27
+ # A user left a public or private channel.
28
+ # @see https://api.slack.com/events/member_left_channel
29
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/member_left_channel.json
30
+ # on :member_left_channel do |data|
31
+
32
+ # A user joined a public or private channel.
33
+ # @see https://api.slack.com/events/member_joined_channel
34
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/member_joined_channel.json
35
+ # on :member_joined_channel do |data|
36
+
17
37
  # The server intends to close the connection soon..
18
38
  # @see https://api.slack.com/events/goodbye
19
39
  # @see https://github.com/dblock/slack-api-ref/blob/master/events/goodbye.json
@@ -54,6 +54,26 @@ module Slack
54
54
 
55
55
  ### RealTime Events
56
56
 
57
+ # The membership of an existing User Group has changed.
58
+ # @see https://api.slack.com/events/subteam_members_changed
59
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/subteam_members_changed.json
60
+ # on :subteam_members_changed do |data|
61
+
62
+ # Subscribe to presence events for the specified users.
63
+ # @see https://api.slack.com/events/presence_sub
64
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/presence_sub.json
65
+ # on :presence_sub do |data|
66
+
67
+ # A user left a public or private channel.
68
+ # @see https://api.slack.com/events/member_left_channel
69
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/member_left_channel.json
70
+ # on :member_left_channel do |data|
71
+
72
+ # A user joined a public or private channel.
73
+ # @see https://api.slack.com/events/member_joined_channel
74
+ # @see https://github.com/dblock/slack-api-ref/blob/master/events/member_joined_channel.json
75
+ # on :member_joined_channel do |data|
76
+
57
77
  # The server intends to close the connection soon..
58
78
  # @see https://api.slack.com/events/goodbye
59
79
  # @see https://github.com/dblock/slack-api-ref/blob/master/events/goodbye.json
@@ -1,3 +1,3 @@
1
1
  module Slack
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.9.1'.freeze
3
3
  end
@@ -1,6 +1,7 @@
1
1
  # This file was auto-generated by lib/tasks/web.rake
2
2
 
3
3
  require_relative 'endpoints/api'
4
+ require_relative 'endpoints/apps_permissions'
4
5
  require_relative 'endpoints/auth'
5
6
  require_relative 'endpoints/bots'
6
7
  require_relative 'endpoints/channels'
@@ -35,6 +36,7 @@ module Slack
35
36
  include Slack::Web::Api::Mixins::Groups
36
37
 
37
38
  include Api
39
+ include AppsPermissions
38
40
  include Auth
39
41
  include Bots
40
42
  include Channels
@@ -6,7 +6,7 @@ module Slack
6
6
  module Endpoints
7
7
  module Api
8
8
  #
9
- # This method helps you test your calling code.
9
+ # Checks API calling code.
10
10
  #
11
11
  # @option options [Object] :error
12
12
  # Error response to return.
@@ -0,0 +1,35 @@
1
+ # This file was auto-generated by lib/tasks/web.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module AppsPermissions
8
+ #
9
+ # Returns list of permissions this app has on a team.
10
+ #
11
+ # @see https://api.slack.com/methods/apps.permissions.info
12
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/apps.permissions/apps.permissions.info.json
13
+ def apps_permissions_info(options = {})
14
+ post('apps.permissions.info', options)
15
+ end
16
+
17
+ #
18
+ # Allows an app to request additional scopes
19
+ #
20
+ # @option options [Object] :scopes
21
+ # A comma separated list of scopes to request for.
22
+ # @option options [Object] :trigger_id
23
+ # Token used to trigger the permissions API.
24
+ # @see https://api.slack.com/methods/apps.permissions.request
25
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/apps.permissions/apps.permissions.request.json
26
+ def apps_permissions_request(options = {})
27
+ throw ArgumentError.new('Required arguments :scopes missing') if options[:scopes].nil?
28
+ throw ArgumentError.new('Required arguments :trigger_id missing') if options[:trigger_id].nil?
29
+ post('apps.permissions.request', options)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -6,7 +6,7 @@ module Slack
6
6
  module Endpoints
7
7
  module Auth
8
8
  #
9
- # This method revokes an access token. Use it when you no longer need a token. For example, with a Sign In With Slack app, call this to log a user out.
9
+ # Revokes a token.
10
10
  #
11
11
  # @option options [Object] :test
12
12
  # Setting this parameter to 1 triggers a testing mode where the specified token will not actually be revoked.
@@ -17,7 +17,7 @@ module Slack
17
17
  end
18
18
 
19
19
  #
20
- # This method checks authentication and tells you who you are.
20
+ # Checks authentication & identity.
21
21
  #
22
22
  # @see https://api.slack.com/methods/auth.test
23
23
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/auth/auth.test.json
@@ -6,7 +6,7 @@ module Slack
6
6
  module Endpoints
7
7
  module Bots
8
8
  #
9
- # This method returns information about a bot user.
9
+ # Gets information about a bot user.
10
10
  #
11
11
  # @option options [Object] :bot
12
12
  # Bot user to get info on.
@@ -6,7 +6,7 @@ module Slack
6
6
  module Endpoints
7
7
  module Channels
8
8
  #
9
- # This method archives a channel.
9
+ # Archives a channel.
10
10
  #
11
11
  # @option options [channel] :channel
12
12
  # Channel to archive.
@@ -19,7 +19,7 @@ module Slack
19
19
  end
20
20
 
21
21
  #
22
- # This method is used to create a channel.
22
+ # Creates a channel.
23
23
  #
24
24
  # @option options [Object] :name
25
25
  # Name of channel to create.
@@ -33,16 +33,16 @@ module Slack
33
33
  end
34
34
 
35
35
  #
36
- # This method returns a portion of message events from the specified channel.
36
+ # Fetches history of messages and events from a channel.
37
37
  #
38
38
  # @option options [channel] :channel
39
39
  # Channel to fetch history for.
40
+ # @option options [Object] :inclusive
41
+ # Include messages with latest or oldest timestamp in results.
40
42
  # @option options [timestamp] :latest
41
43
  # End of time range of messages to include in results.
42
44
  # @option options [timestamp] :oldest
43
45
  # Start of time range of messages to include in results.
44
- # @option options [Object] :inclusive
45
- # Include messages with latest or oldest timestamp in results.
46
46
  # @option options [Object] :unreads
47
47
  # Include unread_count_display in the output?.
48
48
  # @see https://api.slack.com/methods/channels.history
@@ -54,7 +54,7 @@ module Slack
54
54
  end
55
55
 
56
56
  #
57
- # This method returns information about a team channel.
57
+ # Gets information about a channel.
58
58
  #
59
59
  # @option options [channel] :channel
60
60
  # Channel to get info on.
@@ -67,7 +67,7 @@ module Slack
67
67
  end
68
68
 
69
69
  #
70
- # This method is used to invite a user to a channel. The calling user must be a member of the channel.
70
+ # Invites a user to a channel.
71
71
  #
72
72
  # @option options [channel] :channel
73
73
  # Channel to invite user to.
@@ -84,8 +84,7 @@ module Slack
84
84
  end
85
85
 
86
86
  #
87
- # This method is used to join a channel. If the channel does not exist, it is
88
- # created.
87
+ # Joins a channel, creating it if needed.
89
88
  #
90
89
  # @option options [Object] :name
91
90
  # Name of channel to join.
@@ -99,7 +98,7 @@ module Slack
99
98
  end
100
99
 
101
100
  #
102
- # This method allows a user to remove another member from a team channel.
101
+ # Removes a user from a channel.
103
102
  #
104
103
  # @option options [channel] :channel
105
104
  # Channel to remove user from.
@@ -116,7 +115,7 @@ module Slack
116
115
  end
117
116
 
118
117
  #
119
- # This method is used to leave a channel.
118
+ # Leaves a channel.
120
119
  #
121
120
  # @option options [channel] :channel
122
121
  # Channel to leave.
@@ -129,7 +128,7 @@ module Slack
129
128
  end
130
129
 
131
130
  #
132
- # This method returns a list of all channels in the team. This includes channels the caller is in, channels they are not currently in, and archived channels but does not include private channels. The number of (non-deactivated) members in each channel is also returned.
131
+ # Lists all channels in a Slack team.
133
132
  #
134
133
  # @option options [Object] :exclude_archived
135
134
  # Exclude archived channels from the list.
@@ -142,7 +141,7 @@ module Slack
142
141
  end
143
142
 
144
143
  #
145
- # This method moves the read cursor in a channel.
144
+ # Sets the read cursor in a channel.
146
145
  #
147
146
  # @option options [channel] :channel
148
147
  # Channel to set reading cursor in.
@@ -158,7 +157,7 @@ module Slack
158
157
  end
159
158
 
160
159
  #
161
- # This method renames a team channel.
160
+ # Renames a channel.
162
161
  #
163
162
  # @option options [channel] :channel
164
163
  # Channel to rename.
@@ -176,7 +175,7 @@ module Slack
176
175
  end
177
176
 
178
177
  #
179
- # This method returns an entire thread (a message plus all the messages in reply to it).
178
+ # Retrieve a thread of messages posted to a channel
180
179
  #
181
180
  # @option options [channel] :channel
182
181
  # Channel to fetch thread from.
@@ -192,7 +191,7 @@ module Slack
192
191
  end
193
192
 
194
193
  #
195
- # This method is used to change the purpose of a channel. The calling user must be a member of the channel.
194
+ # Sets the purpose for a channel.
196
195
  #
197
196
  # @option options [channel] :channel
198
197
  # Channel to set the purpose of.
@@ -208,7 +207,7 @@ module Slack
208
207
  end
209
208
 
210
209
  #
211
- # This method is used to change the topic of a channel. The calling user must be a member of the channel.
210
+ # Sets the topic for a channel.
212
211
  #
213
212
  # @option options [channel] :channel
214
213
  # Channel to set the topic of.
@@ -224,7 +223,7 @@ module Slack
224
223
  end
225
224
 
226
225
  #
227
- # This method unarchives a channel. The calling user is added to the channel.
226
+ # Unarchives a channel.
228
227
  #
229
228
  # @option options [channel] :channel
230
229
  # Channel to unarchive.
@@ -6,25 +6,25 @@ module Slack
6
6
  module Endpoints
7
7
  module Chat
8
8
  #
9
- # This method deletes a message from a channel.
9
+ # Deletes a message.
10
10
  #
11
- # @option options [timestamp] :ts
12
- # Timestamp of the message to be deleted.
13
11
  # @option options [channel] :channel
14
12
  # Channel containing the message to be deleted.
13
+ # @option options [timestamp] :ts
14
+ # Timestamp of the message to be deleted.
15
15
  # @option options [Object] :as_user
16
16
  # Pass true to delete the message as the authed user. Bot users in this context are considered authed users.
17
17
  # @see https://api.slack.com/methods/chat.delete
18
18
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.delete.json
19
19
  def chat_delete(options = {})
20
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
21
20
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
21
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
22
22
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
23
23
  post('chat.delete', options)
24
24
  end
25
25
 
26
26
  #
27
- # This method sends a me message to a channel from the calling user.
27
+ # Share a me message into a channel.
28
28
  #
29
29
  # @option options [channel] :channel
30
30
  # Channel to send message to. Can be a public channel, private group or IM channel. Can be an encoded ID, or a name.
@@ -39,34 +39,67 @@ module Slack
39
39
  end
40
40
 
41
41
  #
42
- # This method posts a message to a public channel, private channel, or direct message/IM channel.
42
+ # Sends an ephemeral message to a user in a channel.
43
43
  #
44
44
  # @option options [channel] :channel
45
- # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
45
+ # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name.
46
46
  # @option options [Object] :text
47
47
  # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead.
48
+ # @option options [user] :user
49
+ # id of the user who will receive the ephemeral message. The user should be in the channel specified by the channel argument.
50
+ # @option options [Object] :as_user
51
+ # Pass true to post the message as the authed bot. Defaults to false.
52
+ # @option options [Object] :attachments
53
+ # A JSON-based array of structured attachments, presented as a URL-encoded string.
54
+ # @option options [Object] :link_names
55
+ # Find and link channel names and usernames.
48
56
  # @option options [Object] :parse
49
57
  # Change how messages are treated. Defaults to none. See below.
58
+ # @see https://api.slack.com/methods/chat.postEphemeral
59
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.postEphemeral.json
60
+ def chat_postEphemeral(options = {})
61
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
62
+ throw ArgumentError.new('Required arguments :text missing') if options[:text].nil?
63
+ throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
64
+ options = options.merge(user: users_id(options)['user']['id']) if options[:user]
65
+ # attachments must be passed as an encoded JSON string
66
+ if options.key?(:attachments)
67
+ attachments = options[:attachments]
68
+ attachments = JSON.dump(attachments) unless attachments.is_a?(String)
69
+ options = options.merge(attachments: attachments)
70
+ end
71
+ post('chat.postEphemeral', options)
72
+ end
73
+
74
+ #
75
+ # Sends a message to a channel.
76
+ #
77
+ # @option options [channel] :channel
78
+ # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
79
+ # @option options [Object] :text
80
+ # Text of the message to send. See below for an explanation of formatting. This field is usually required, unless you're providing only attachments instead.
81
+ # @option options [Object] :as_user
82
+ # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
83
+ # @option options [Object] :attachments
84
+ # A JSON-based array of structured attachments, presented as a URL-encoded string.
85
+ # @option options [Object] :icon_emoji
86
+ # Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
87
+ # @option options [Object] :icon_url
88
+ # URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
50
89
  # @option options [Object] :link_names
51
90
  # Find and link channel names and usernames.
52
- # @option options [Object] :attachments
53
- # Structured message attachments.
91
+ # @option options [Object] :parse
92
+ # Change how messages are treated. Defaults to none. See below.
93
+ # @option options [Object] :reply_broadcast
94
+ # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
95
+ # @option options [Object] :thread_ts
96
+ # Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
54
97
  # @option options [Object] :unfurl_links
55
98
  # Pass true to enable unfurling of primarily text-based content.
56
99
  # @option options [Object] :unfurl_media
57
100
  # Pass false to disable unfurling of media content.
58
101
  # @option options [Object] :username
59
102
  # Set your bot's user name. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
60
- # @option options [Object] :as_user
61
- # Pass true to post the message as the authed user, instead of as a bot. Defaults to false. See authorship below.
62
- # @option options [Object] :icon_url
63
- # URL to an image to use as the icon for this message. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
64
- # @option options [Object] :icon_emoji
65
- # Emoji to use as the icon for this message. Overrides icon_url. Must be used in conjunction with as_user set to false, otherwise ignored. See authorship below.
66
- # @option options [Object] :thread_ts
67
- # Provide another message's ts value to make this message a reply. Avoid using a reply's ts value; use its parent instead.
68
- # @option options [Object] :reply_broadcast
69
- # Used in conjunction with thread_ts and indicates whether reply should be made visible to everyone in the channel or conversation. Defaults to false.
70
103
  # @see https://api.slack.com/methods/chat.postMessage
71
104
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.postMessage.json
72
105
  def chat_postMessage(options = {})
@@ -82,16 +115,20 @@ module Slack
82
115
  end
83
116
 
84
117
  #
85
- # This method attaches Slack app unfurl behavior to a specified and relevant message. A user token is required as this method does not support bot user tokens.
118
+ # Provide custom unfurl behavior for user-posted URLs
86
119
  #
87
120
  # @option options [channel] :channel
88
121
  # Channel ID of the message.
89
122
  # @option options [timestamp] :ts
90
123
  # Timestamp of the message to add unfurl behavior to.
91
124
  # @option options [Object] :unfurls
92
- # JSON mapping a set of URLs from the message to their unfurl attachments.
125
+ # URL-encoded JSON map with keys set to URLs featured in the the message, pointing to their unfurl message attachments.
126
+ # @option options [Object] :user_auth_message
127
+ # Provide a simply-formatted string to send as an ephemeral message to the user as invitation to authenticate further and enable full unfurling behavior.
93
128
  # @option options [Object] :user_auth_required
94
129
  # Set to true or 1 to indicate the user must install your Slack app to trigger unfurls for this domain.
130
+ # @option options [Object] :user_auth_url
131
+ # Send users to this custom URL where they will complete authentication in your app to fully trigger unfurling. Value should be properly URL-encoded.
95
132
  # @see https://api.slack.com/methods/chat.unfurl
96
133
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.unfurl.json
97
134
  def chat_unfurl(options = {})
@@ -103,28 +140,28 @@ module Slack
103
140
  end
104
141
 
105
142
  #
106
- # This method updates a message in a channel. Though related to chat.postMessage, some parameters of chat.update are handled differently.
143
+ # Updates a message.
107
144
  #
108
- # @option options [timestamp] :ts
109
- # Timestamp of the message to be updated.
110
145
  # @option options [channel] :channel
111
146
  # Channel containing the message to be updated.
112
147
  # @option options [Object] :text
113
148
  # New text for the message, using the default formatting rules.
149
+ # @option options [timestamp] :ts
150
+ # Timestamp of the message to be updated.
151
+ # @option options [Object] :as_user
152
+ # Pass true to update the message as the authed user. Bot users in this context are considered authed users.
114
153
  # @option options [Object] :attachments
115
- # Structured message attachments.
116
- # @option options [Object] :parse
117
- # Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
154
+ # A JSON-based array of structured attachments, presented as a URL-encoded string.
118
155
  # @option options [Object] :link_names
119
156
  # Find and link channel names and usernames. Defaults to none. This parameter should be used in conjunction with parse. To set link_names to 1, specify a parse mode of full.
120
- # @option options [Object] :as_user
121
- # Pass true to update the message as the authed user. Bot users in this context are considered authed users.
157
+ # @option options [Object] :parse
158
+ # Change how messages are treated. Defaults to client, unlike chat.postMessage. See below.
122
159
  # @see https://api.slack.com/methods/chat.update
123
160
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/chat/chat.update.json
124
161
  def chat_update(options = {})
125
- throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
126
162
  throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
127
163
  throw ArgumentError.new('Required arguments :text or :attachments missing') if options[:text].nil? && options[:attachments].nil?
164
+ throw ArgumentError.new('Required arguments :ts missing') if options[:ts].nil?
128
165
  options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
129
166
  # attachments must be passed as an encoded JSON string
130
167
  if options.key?(:attachments)