slack-web-api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +2 -0
  5. data/.travis.yml +6 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +13 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +33 -0
  10. data/Rakefile +13 -0
  11. data/examples/basic.rb +35 -0
  12. data/lib/faraday/raise_http_exception.rb +51 -0
  13. data/lib/slack.rb +27 -0
  14. data/lib/slack/api.rb +24 -0
  15. data/lib/slack/client.rb +4 -0
  16. data/lib/slack/configuration.rb +76 -0
  17. data/lib/slack/connection.rb +29 -0
  18. data/lib/slack/endpoint.rb +43 -0
  19. data/lib/slack/endpoint/api.rb +23 -0
  20. data/lib/slack/endpoint/auth.rb +19 -0
  21. data/lib/slack/endpoint/channels.rb +236 -0
  22. data/lib/slack/endpoint/chat.rb +86 -0
  23. data/lib/slack/endpoint/emoji.rb +19 -0
  24. data/lib/slack/endpoint/files.rb +100 -0
  25. data/lib/slack/endpoint/groups.rb +262 -0
  26. data/lib/slack/endpoint/im.rb +90 -0
  27. data/lib/slack/endpoint/mpim.rb +90 -0
  28. data/lib/slack/endpoint/oauth.rb +31 -0
  29. data/lib/slack/endpoint/pins.rb +64 -0
  30. data/lib/slack/endpoint/presence.rb +22 -0
  31. data/lib/slack/endpoint/reactions.rb +94 -0
  32. data/lib/slack/endpoint/search.rb +80 -0
  33. data/lib/slack/endpoint/stars.rb +65 -0
  34. data/lib/slack/endpoint/team.rb +57 -0
  35. data/lib/slack/endpoint/usergroups.rb +122 -0
  36. data/lib/slack/endpoint/users.rb +78 -0
  37. data/lib/slack/error.rb +19 -0
  38. data/lib/slack/request.rb +41 -0
  39. data/lib/slack/version.rb +3 -0
  40. data/slack.gemspec +38 -0
  41. data/spec/api_spec.rb +23 -0
  42. data/spec/auth_spec.rb +22 -0
  43. data/spec/channels_spec.rb +247 -0
  44. data/spec/spec_helper.rb +86 -0
  45. metadata +313 -0
@@ -0,0 +1,64 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Pins
6
+ #
7
+ # This method pins an item (file, file comment, channel message, or group message) to a particular channel.
8
+ # The channel argument is required and one of file, file_comment, or timestamp must also be specified.
9
+ #
10
+ # @option options [Object] :channel
11
+ # Channel to pin the item in.
12
+ # @option options [Object] :file
13
+ # File to pin.
14
+ # @option options [Object] :file_comment
15
+ # File comment to pin.
16
+ # @option options [Object] :timestamp
17
+ # Timestamp of the message to pin.
18
+ # @see https://api.slack.com/methods/pins.add
19
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.add.md
20
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.add.json
21
+ def pins_add(options={})
22
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
23
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
24
+ post("pins.add", options)
25
+ end
26
+
27
+ #
28
+ # This method lists the items pinned to a channel.
29
+ #
30
+ # @option options [Object] :channel
31
+ # Channel to get pinned items for.
32
+ # @see https://api.slack.com/methods/pins.list
33
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.list.md
34
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.list.json
35
+ def pins_list(options={})
36
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
37
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
38
+ post("pins.list", options)
39
+ end
40
+
41
+ #
42
+ # This method un-pins an item (file, file comment, channel message, or group message) from a channel.
43
+ # The channel argument is required and one of file, file_comment, or timestamp must also be specified.
44
+ #
45
+ # @option options [Object] :channel
46
+ # Channel where the item is pinned to.
47
+ # @option options [Object] :file
48
+ # File to un-pin.
49
+ # @option options [Object] :file_comment
50
+ # File comment to un-pin.
51
+ # @option options [Object] :timestamp
52
+ # Timestamp of the message to un-pin.
53
+ # @see https://api.slack.com/methods/pins.remove
54
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.remove.md
55
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/pins.remove.json
56
+ def pins_remove(options={})
57
+ throw ArgumentError.new("Required arguments :channel missing") if options[:channel].nil?
58
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
59
+ post("pins.remove", options)
60
+ end
61
+
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,22 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Presence
6
+ #
7
+ # Manually set user presence
8
+ #
9
+ # @option options [Object] :presence
10
+ # Either `active` or `away`
11
+ # @see https://api.slack.com/methods/presence.set
12
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/presence.set.md
13
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/presence.set.json
14
+ def presence_set(options={})
15
+ throw ArgumentError.new("Required arguments :presence missing") if options[:presence].nil?
16
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
17
+ post("presence.set", options)
18
+ end
19
+
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,94 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Reactions
6
+ #
7
+ # This method adds a reaction (emoji) to an item (file, file comment, channel message, group message, or direct message).
8
+ # One of file, file_comment, or the combination of channel and timestamp must be specified.
9
+ #
10
+ # @option options [Object] :name
11
+ # Reaction (emoji) name.
12
+ # @option options [Object] :file
13
+ # File to add reaction to.
14
+ # @option options [Object] :file_comment
15
+ # File comment to add reaction to.
16
+ # @option options [Object] :channel
17
+ # Channel where the message to add reaction to was posted.
18
+ # @option options [Object] :timestamp
19
+ # Timestamp of the message to add reaction to.
20
+ # @see https://api.slack.com/methods/reactions.add
21
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.add.md
22
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.add.json
23
+ def reactions_add(options={})
24
+ throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
25
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
26
+ post("reactions.add", options)
27
+ end
28
+
29
+ #
30
+ # This method returns a list of all reactions for a single item (file, file comment, channel message, group message, or direct message).
31
+ #
32
+ # @option options [Object] :file
33
+ # File to get reactions for.
34
+ # @option options [Object] :file_comment
35
+ # File comment to get reactions for.
36
+ # @option options [Object] :channel
37
+ # Channel where the message to get reactions for was posted.
38
+ # @option options [Object] :timestamp
39
+ # Timestamp of the message to get reactions for.
40
+ # @option options [Object] :full
41
+ # If true always return the complete reaction list.
42
+ # @see https://api.slack.com/methods/reactions.get
43
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.get.md
44
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.get.json
45
+ def reactions_get(options={})
46
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
47
+ post("reactions.get", options)
48
+ end
49
+
50
+ #
51
+ # This method returns a list of all items (file, file comment, channel message, group message, or direct message) reacted to by a user.
52
+ #
53
+ # @option options [Object] :user
54
+ # Show reactions made by this user. Defaults to the authed user.
55
+ # @option options [Object] :full
56
+ # If true always return the complete reaction list.
57
+ # @option options [Object] :count
58
+ # Number of items to return per page.
59
+ # @option options [Object] :page
60
+ # Page number of results to return.
61
+ # @see https://api.slack.com/methods/reactions.list
62
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.list.md
63
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.list.json
64
+ def reactions_list(options={})
65
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
66
+ post("reactions.list", options)
67
+ end
68
+
69
+ #
70
+ # This method removes a reaction (emoji) from an item (file, file comment, channel message, group message, or direct message).
71
+ # One of file, file_comment, or the combination of channel and timestamp must be specified.
72
+ #
73
+ # @option options [Object] :name
74
+ # Reaction (emoji) name.
75
+ # @option options [Object] :file
76
+ # File to remove reaction from.
77
+ # @option options [Object] :file_comment
78
+ # File comment to remove reaction from.
79
+ # @option options [Object] :channel
80
+ # Channel where the message to remove reaction from was posted.
81
+ # @option options [Object] :timestamp
82
+ # Timestamp of the message to remove reaction from.
83
+ # @see https://api.slack.com/methods/reactions.remove
84
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.remove.md
85
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/reactions.remove.json
86
+ def reactions_remove(options={})
87
+ throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
88
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
89
+ post("reactions.remove", options)
90
+ end
91
+
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,80 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Search
6
+ #
7
+ # This method allows to to search both messages and files in a single call.
8
+ #
9
+ # @option options [Object] :query
10
+ # Search query. May contains booleans, etc.
11
+ # @option options [Object] :sort
12
+ # Return matches sorted by either score or timestamp.
13
+ # @option options [Object] :sort_dir
14
+ # Change sort direction to ascending (asc) or descending (desc).
15
+ # @option options [Object] :highlight
16
+ # Pass a value of 1 to enable query highlight markers (see below).
17
+ # @option options [Object] :count
18
+ # Number of items to return per page.
19
+ # @option options [Object] :page
20
+ # Page number of results to return.
21
+ # @see https://api.slack.com/methods/search.all
22
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.all.md
23
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.all.json
24
+ def search_all(options={})
25
+ throw ArgumentError.new("Required arguments :query missing") if options[:query].nil?
26
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
27
+ post("search.all", options)
28
+ end
29
+
30
+ #
31
+ # This method returns files matching a search query.
32
+ #
33
+ # @option options [Object] :query
34
+ # Search query. May contain booleans, etc.
35
+ # @option options [Object] :sort
36
+ # Return matches sorted by either score or timestamp.
37
+ # @option options [Object] :sort_dir
38
+ # Change sort direction to ascending (asc) or descending (desc).
39
+ # @option options [Object] :highlight
40
+ # Pass a value of 1 to enable query highlight markers (see below).
41
+ # @option options [Object] :count
42
+ # Number of items to return per page.
43
+ # @option options [Object] :page
44
+ # Page number of results to return.
45
+ # @see https://api.slack.com/methods/search.files
46
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.files.md
47
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.files.json
48
+ def search_files(options={})
49
+ throw ArgumentError.new("Required arguments :query missing") if options[:query].nil?
50
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
51
+ post("search.files", options)
52
+ end
53
+
54
+ #
55
+ # This method returns messages matching a search query.
56
+ #
57
+ # @option options [Object] :query
58
+ # Search query. May contains booleans, etc.
59
+ # @option options [Object] :sort
60
+ # Return matches sorted by either score or timestamp.
61
+ # @option options [Object] :sort_dir
62
+ # Change sort direction to ascending (asc) or descending (desc).
63
+ # @option options [Object] :highlight
64
+ # Pass a value of 1 to enable query highlight markers (see below).
65
+ # @option options [Object] :count
66
+ # Number of items to return per page.
67
+ # @option options [Object] :page
68
+ # Page number of results to return.
69
+ # @see https://api.slack.com/methods/search.messages
70
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.messages.md
71
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/search.messages.json
72
+ def search_messages(options={})
73
+ throw ArgumentError.new("Required arguments :query missing") if options[:query].nil?
74
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
75
+ post("search.messages", options)
76
+ end
77
+
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,65 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Stars
6
+ #
7
+ # This method adds a star to an item (message, file, file comment, channel, private group, or DM) on behalf of the authenticated user.
8
+ # One of file, file_comment, channel, or the combination of channel and timestamp must be specified.
9
+ #
10
+ # @option options [Object] :file
11
+ # File to add star to.
12
+ # @option options [Object] :file_comment
13
+ # File comment to add star to.
14
+ # @option options [Object] :channel
15
+ # Channel to add star to, or channel where the message to add star to was posted (used with timestamp).
16
+ # @option options [Object] :timestamp
17
+ # Timestamp of the message to add star to.
18
+ # @see https://api.slack.com/methods/stars.add
19
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.add.md
20
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.add.json
21
+ def stars_add(options={})
22
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
23
+ post("stars.add", options)
24
+ end
25
+
26
+ #
27
+ # This method lists the items starred by a user.
28
+ #
29
+ # @option options [Object] :user
30
+ # Show stars by this user. Defaults to the authed user.
31
+ # @option options [Object] :count
32
+ # Number of items to return per page.
33
+ # @option options [Object] :page
34
+ # Page number of results to return.
35
+ # @see https://api.slack.com/methods/stars.list
36
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.list.md
37
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.list.json
38
+ def stars_list(options={})
39
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
40
+ post("stars.list", options)
41
+ end
42
+
43
+ #
44
+ # This method removes a star from an item (message, file, file comment, channel, private group, or DM) on behalf of the authenticated user.
45
+ # One of file, file_comment, channel, or the combination of channel and timestamp must be specified.
46
+ #
47
+ # @option options [Object] :file
48
+ # File to remove star from.
49
+ # @option options [Object] :file_comment
50
+ # File comment to remove star from.
51
+ # @option options [Object] :channel
52
+ # Channel to remove star from, or channel where the message to remove star from was posted (used with timestamp).
53
+ # @option options [Object] :timestamp
54
+ # Timestamp of the message to remove star from.
55
+ # @see https://api.slack.com/methods/stars.remove
56
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.remove.md
57
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/stars.remove.json
58
+ def stars_remove(options={})
59
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
60
+ post("stars.remove", options)
61
+ end
62
+
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,57 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Team
6
+ #
7
+ # This method is used to get the access logs for users on a team.
8
+ #
9
+ # @option options [Object] :count
10
+ # Number of items to return per page.
11
+ # @option options [Object] :page
12
+ # Page number of results to return.
13
+ # @see https://api.slack.com/methods/team.accessLogs
14
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.accessLogs.md
15
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.accessLogs.json
16
+ def team_accessLogs(options={})
17
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
18
+ post("team.accessLogs", options)
19
+ end
20
+
21
+ #
22
+ # This method provides information about your team.
23
+ #
24
+ # @see https://api.slack.com/methods/team.info
25
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.info.md
26
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.info.json
27
+ def team_info(options={})
28
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
29
+ post("team.info", options)
30
+ end
31
+
32
+ #
33
+ # This method lists the integration activity logs for a team, including when integrations are added, modified and removed. This method can only be called by Admins.
34
+ #
35
+ # @option options [Object] :service_id
36
+ # Filter logs to this service. Defaults to all logs.
37
+ # @option options [Object] :app_id
38
+ # Filter logs to this API application. Defaults to all logs.
39
+ # @option options [Object] :user
40
+ # Filter logs generated by this user’s actions. Defaults to all logs.
41
+ # @option options [Object] :change_type
42
+ # Filter logs with this change type. Defaults to all logs.
43
+ # @option options [Object] :count
44
+ # Number of items to return per page.
45
+ # @option options [Object] :page
46
+ # Page number of results to return.
47
+ # @see https://api.slack.com/methods/team.integrationLogs
48
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.integrationLogs.md
49
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/team.integrationLogs.json
50
+ def team_integrationLogs(options={})
51
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
52
+ post("team.integrationLogs", options)
53
+ end
54
+
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,122 @@
1
+ # This file was auto-generated by lib/generators/tasks/generate.rb
2
+
3
+ module Slack
4
+ module Endpoint
5
+ module Usergroups
6
+ #
7
+ # This method is used to create a user group.
8
+ #
9
+ # @option options [Object] :name
10
+ # A name for the user group. Must be unique among user groups.
11
+ # @option options [Object] :handle
12
+ # A mention handle. Must be unique among channels, users and user groups.
13
+ # @option options [Object] :description
14
+ # A short description of the user group.
15
+ # @option options [Object] :channels
16
+ # A comma separated string of encoded channel IDs for which the user group uses as a default.
17
+ # @option options [Object] :include_count
18
+ # Include the number of users in each user group.
19
+ # @see https://api.slack.com/methods/usergroups.create
20
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.create.md
21
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.create.json
22
+ def usergroups_create(options={})
23
+ throw ArgumentError.new("Required arguments :name missing") if options[:name].nil?
24
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
25
+ post("usergroups.create", options)
26
+ end
27
+
28
+ #
29
+ # This method disables an existing user group.
30
+ #
31
+ # @option options [Object] :usergroup
32
+ # The encoded ID of the user group to disable.
33
+ # @option options [Object] :include_count
34
+ # Include the number of users in the user group.
35
+ # @see https://api.slack.com/methods/usergroups.disable
36
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.disable.md
37
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.disable.json
38
+ def usergroups_disable(options={})
39
+ throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
40
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
41
+ post("usergroups.disable", options)
42
+ end
43
+
44
+ #
45
+ # This method enables a user group which was previously disabled.
46
+ #
47
+ # @option options [Object] :usergroup
48
+ # The encoded ID of the user group to enable.
49
+ # @option options [Object] :include_count
50
+ # Include the number of users in the user group.
51
+ # @see https://api.slack.com/methods/usergroups.enable
52
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.enable.md
53
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.enable.json
54
+ def usergroups_enable(options={})
55
+ throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
56
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
57
+ post("usergroups.enable", options)
58
+ end
59
+
60
+ #
61
+ # This method returns a list of all user groups in the team. This can optionally include disabled user groups.
62
+ #
63
+ # @option options [Object] :include_disabled
64
+ # Include disabled user groups.
65
+ # @option options [Object] :include_count
66
+ # Include the number of users in each user group.
67
+ # @option options [Object] :include_users
68
+ # Include the list of users for each user group.
69
+ # @see https://api.slack.com/methods/usergroups.list
70
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.list.md
71
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.list.json
72
+ def usergroups_list(options={})
73
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
74
+ post("usergroups.list", options)
75
+ end
76
+
77
+ #
78
+ # This method updates the properties of an existing user group.
79
+ #
80
+ # @option options [Object] :usergroup
81
+ # The encoded ID of the user group to update.
82
+ # @option options [Object] :name
83
+ # A name for the user group. Must be unique among user groups.
84
+ # @option options [Object] :handle
85
+ # A mention handle. Must be unique among channels, users and user groups.
86
+ # @option options [Object] :description
87
+ # A short description of the user group.
88
+ # @option options [Object] :channels
89
+ # A comma separated string of encoded channel IDs for which the user group uses as a default.
90
+ # @option options [Object] :include_count
91
+ # Include the number of users in the user group.
92
+ # @see https://api.slack.com/methods/usergroups.update
93
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.update.md
94
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.update.json
95
+ def usergroups_update(options={})
96
+ throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
97
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
98
+ post("usergroups.update", options)
99
+ end
100
+
101
+ #
102
+ # This method updates the list of users that belong to a user group. This method replaces all users in a user group with the list of users provided in the users parameter.
103
+ #
104
+ # @option options [Object] :usergroup
105
+ # The encoded ID of the user group to update.
106
+ # @option options [Object] :users
107
+ # A comma separated string of encoded user IDs that represent the entire list of users for the user group.
108
+ # @option options [Object] :include_count
109
+ # Include the number of users in the user group.
110
+ # @see https://api.slack.com/methods/usergroups.users
111
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.users.md
112
+ # @see https://github.com/aki017/slack-api-docs/blob/master/methods/usergroups.users.json
113
+ def usergroups_users(options={})
114
+ throw ArgumentError.new("Required arguments :usergroup missing") if options[:usergroup].nil?
115
+ throw ArgumentError.new("Required arguments :users missing") if options[:users].nil?
116
+ options[:attachments] = options[:attachments].to_json if Hash === options[:attachments]
117
+ post("usergroups.users", options)
118
+ end
119
+
120
+ end
121
+ end
122
+ end