slack-ruby-client 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,19 +6,19 @@ module Slack
6
6
  module Endpoints
7
7
  module Oauth
8
8
  #
9
- # Exchanges a temporary OAuth code for an API token.
9
+ # This method allows you to exchange a temporary OAuth code for an API access token.
10
+ # This is used as part of the OAuth authentication flow.
10
11
  #
11
12
  # @option options [Object] :client_id
12
13
  # Issued when you created your application.
13
14
  # @option options [Object] :client_secret
14
15
  # Issued when you created your application.
15
16
  # @option options [Object] :code
16
- # The `code` param returned via the OAuth callback.
17
+ # The code param returned via the OAuth callback.
17
18
  # @option options [Object] :redirect_uri
18
19
  # This must match the originally submitted URI (if one was sent).
19
20
  # @see https://api.slack.com/methods/oauth.access
20
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/oauth.access.md
21
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/oauth.access.json
21
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/oauth.access.json
22
22
  def oauth_access(options = {})
23
23
  throw ArgumentError.new('Required arguments :client_id missing') if options[:client_id].nil?
24
24
  throw ArgumentError.new('Required arguments :client_secret missing') if options[:client_secret].nil?
@@ -0,0 +1,61 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Pins
8
+ #
9
+ # This method pins an item (file, file comment, channel message, or group message) to a particular channel.
10
+ # The channel argument is required and one of file, file_comment, or timestamp must also be specified.
11
+ #
12
+ # @option options [Object] :channel
13
+ # Channel to pin the item in.
14
+ # @option options [Object] :file
15
+ # File to pin.
16
+ # @option options [Object] :file_comment
17
+ # File comment to pin.
18
+ # @option options [Object] :timestamp
19
+ # Timestamp of the message to pin.
20
+ # @see https://api.slack.com/methods/pins.add
21
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/pins.add.json
22
+ def pins_add(options = {})
23
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
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/dblock/slack-api-ref/blob/master/methods/pins.list.json
34
+ def pins_list(options = {})
35
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
36
+ post('pins.list', options)
37
+ end
38
+
39
+ #
40
+ # This method un-pins an item (file, file comment, channel message, or group message) from a channel.
41
+ # The channel argument is required and one of file, file_comment, or timestamp must also be specified.
42
+ #
43
+ # @option options [Object] :channel
44
+ # Channel where the item is pinned to.
45
+ # @option options [Object] :file
46
+ # File to un-pin.
47
+ # @option options [Object] :file_comment
48
+ # File comment to un-pin.
49
+ # @option options [Object] :timestamp
50
+ # Timestamp of the message to un-pin.
51
+ # @see https://api.slack.com/methods/pins.remove
52
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/pins.remove.json
53
+ def pins_remove(options = {})
54
+ throw ArgumentError.new('Required arguments :channel missing') if options[:channel].nil?
55
+ post('pins.remove', options)
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -6,13 +6,12 @@ module Slack
6
6
  module Endpoints
7
7
  module Presence
8
8
  #
9
- # Manually set user presence
9
+ # Manually set user presence.
10
10
  #
11
11
  # @option options [Object] :presence
12
- # Either `active` or `away`
12
+ # Either `active` or `away`.
13
13
  # @see https://api.slack.com/methods/presence.set
14
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/presence.set.md
15
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/presence.set.json
14
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/presence.set.json
16
15
  def presence_set(options = {})
17
16
  throw ArgumentError.new('Required arguments :presence missing') if options[:presence].nil?
18
17
  post('presence.set', options)
@@ -0,0 +1,85 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Reactions
8
+ #
9
+ # This method adds a reaction (emoji) to an item (file, file comment, channel message, group message, or direct message).
10
+ # One of file, file_comment, or the combination of channel and timestamp must be specified.
11
+ #
12
+ # @option options [Object] :name
13
+ # Reaction (emoji) name.
14
+ # @option options [Object] :file
15
+ # File to add reaction to.
16
+ # @option options [Object] :file_comment
17
+ # File comment to add reaction to.
18
+ # @option options [Object] :channel
19
+ # Channel where the message to add reaction to was posted.
20
+ # @option options [Object] :timestamp
21
+ # Timestamp of the message to add reaction to.
22
+ # @see https://api.slack.com/methods/reactions.add
23
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.add.json
24
+ def reactions_add(options = {})
25
+ throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
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/dblock/slack-api-ref/blob/master/methods/reactions.get.json
44
+ def reactions_get(options = {})
45
+ post('reactions.get', options)
46
+ end
47
+
48
+ #
49
+ # This method returns a list of all items (file, file comment, channel message, group message, or direct message) reacted to by a user.
50
+ #
51
+ # @option options [Object] :user
52
+ # Show reactions made by this user. Defaults to the authed user.
53
+ # @option options [Object] :full
54
+ # If true always return the complete reaction list.
55
+ # @see https://api.slack.com/methods/reactions.list
56
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.list.json
57
+ def reactions_list(options = {})
58
+ post('reactions.list', options)
59
+ end
60
+
61
+ #
62
+ # This method removes a reaction (emoji) from an item (file, file comment, channel message, group message, or direct message).
63
+ # One of file, file_comment, or the combination of channel and timestamp must be specified.
64
+ #
65
+ # @option options [Object] :name
66
+ # Reaction (emoji) name.
67
+ # @option options [Object] :file
68
+ # File to remove reaction from.
69
+ # @option options [Object] :file_comment
70
+ # File comment to remove reaction from.
71
+ # @option options [Object] :channel
72
+ # Channel where the message to remove reaction from was posted.
73
+ # @option options [Object] :timestamp
74
+ # Timestamp of the message to remove reaction from.
75
+ # @see https://api.slack.com/methods/reactions.remove
76
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/reactions.remove.json
77
+ def reactions_remove(options = {})
78
+ throw ArgumentError.new('Required arguments :name missing') if options[:name].nil?
79
+ post('reactions.remove', options)
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
@@ -6,11 +6,15 @@ module Slack
6
6
  module Endpoints
7
7
  module Rtm
8
8
  #
9
- # Starts a Real Time Messaging session.
9
+ # This method starts a Real Time Messaging API session. Refer to the
10
+ # RTM API documentation for full details on how to use the RTM API.
10
11
  #
12
+ # @option options [Object] :simple_latest
13
+ # Return timestamp only for latest message object of each channel (improves performance).
14
+ # @option options [Object] :no_unreads
15
+ # Skip unread counts for each channel (improves performance).
11
16
  # @see https://api.slack.com/methods/rtm.start
12
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/rtm.start.md
13
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/rtm.start.json
17
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/rtm.start.json
14
18
  def rtm_start(options = {})
15
19
  post('rtm.start', options)
16
20
  end
@@ -6,57 +6,54 @@ module Slack
6
6
  module Endpoints
7
7
  module Search
8
8
  #
9
- # Searches for messages and files matching a query.
9
+ # This method allows to to search both messages and files in a single call.
10
10
  #
11
11
  # @option options [Object] :query
12
12
  # Search query. May contains booleans, etc.
13
13
  # @option options [Object] :sort
14
- # Return matches sorted by either `score` or `timestamp`.
14
+ # Return matches sorted by either score or timestamp.
15
15
  # @option options [Object] :sort_dir
16
- # Change sort direction to ascending (`asc`) or descending (`desc`).
16
+ # Change sort direction to ascending (asc) or descending (desc).
17
17
  # @option options [Object] :highlight
18
- # Pass a value of `1` to enable query highlight markers (see below).
18
+ # Pass a value of 1 to enable query highlight markers (see below).
19
19
  # @see https://api.slack.com/methods/search.all
20
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/search.all.md
21
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/search.all.json
20
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/search.all.json
22
21
  def search_all(options = {})
23
22
  throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
24
23
  post('search.all', options)
25
24
  end
26
25
 
27
26
  #
28
- # Searches for files matching a query.
27
+ # This method returns files matching a search query.
29
28
  #
30
29
  # @option options [Object] :query
31
- # Search query. May contains booleans, etc.
30
+ # Search query. May contain booleans, etc.
32
31
  # @option options [Object] :sort
33
- # Return matches sorted by either `score` or `timestamp`.
32
+ # Return matches sorted by either score or timestamp.
34
33
  # @option options [Object] :sort_dir
35
- # Change sort direction to ascending (`asc`) or descending (`desc`).
34
+ # Change sort direction to ascending (asc) or descending (desc).
36
35
  # @option options [Object] :highlight
37
- # Pass a value of `1` to enable query highlight markers (see below).
36
+ # Pass a value of 1 to enable query highlight markers (see below).
38
37
  # @see https://api.slack.com/methods/search.files
39
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/search.files.md
40
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/search.files.json
38
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/search.files.json
41
39
  def search_files(options = {})
42
40
  throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
43
41
  post('search.files', options)
44
42
  end
45
43
 
46
44
  #
47
- # Searches for messages matching a query.
45
+ # This method returns messages matching a search query.
48
46
  #
49
47
  # @option options [Object] :query
50
48
  # Search query. May contains booleans, etc.
51
49
  # @option options [Object] :sort
52
- # Return matches sorted by either `score` or `timestamp`.
50
+ # Return matches sorted by either score or timestamp.
53
51
  # @option options [Object] :sort_dir
54
- # Change sort direction to ascending (`asc`) or descending (`desc`).
52
+ # Change sort direction to ascending (asc) or descending (desc).
55
53
  # @option options [Object] :highlight
56
- # Pass a value of `1` to enable query highlight markers (see below).
54
+ # Pass a value of 1 to enable query highlight markers (see below).
57
55
  # @see https://api.slack.com/methods/search.messages
58
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/search.messages.md
59
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/search.messages.json
56
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/search.messages.json
60
57
  def search_messages(options = {})
61
58
  throw ArgumentError.new('Required arguments :query missing') if options[:query].nil?
62
59
  post('search.messages', options)
@@ -6,13 +6,12 @@ module Slack
6
6
  module Endpoints
7
7
  module Stars
8
8
  #
9
- # Lists stars for a user.
9
+ # This method lists the items starred by a user.
10
10
  #
11
- # @option options [user] :user
11
+ # @option options [Object] :user
12
12
  # Show stars by this user. Defaults to the authed user.
13
13
  # @see https://api.slack.com/methods/stars.list
14
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/stars.list.md
15
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/stars.list.json
14
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/stars.list.json
16
15
  def stars_list(options = {})
17
16
  post('stars.list', options)
18
17
  end
@@ -0,0 +1,29 @@
1
+ # This file was auto-generated by lib/slack/web/api/tasks/generate.rake
2
+
3
+ module Slack
4
+ module Web
5
+ module Api
6
+ module Endpoints
7
+ module Team
8
+ #
9
+ # This method is used to get the access logs for users on a team.
10
+ #
11
+ # @see https://api.slack.com/methods/team.accessLogs
12
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/team.accessLogs.json
13
+ def team_accessLogs(options = {})
14
+ post('team.accessLogs', options)
15
+ end
16
+
17
+ #
18
+ # This method provides information about your team.
19
+ #
20
+ # @see https://api.slack.com/methods/team.info
21
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/team.info.json
22
+ def team_info(options = {})
23
+ post('team.info', options)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -6,59 +6,60 @@ module Slack
6
6
  module Endpoints
7
7
  module Users
8
8
  #
9
- # Gets user presence information.
9
+ # This method lets you find out information about a user's presence.
10
+ # Consult the presence documentation for more details.
10
11
  #
11
- # @option options [user] :user
12
+ # @option options [Object] :user
12
13
  # User to get presence info on. Defaults to the authed user.
13
14
  # @see https://api.slack.com/methods/users.getPresence
14
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.getPresence.md
15
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.getPresence.json
15
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/users.getPresence.json
16
16
  def users_getPresence(options = {})
17
17
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
18
18
  post('users.getPresence', options)
19
19
  end
20
20
 
21
21
  #
22
- # Gets information about a user.
22
+ # This method returns information about a team member.
23
23
  #
24
- # @option options [user] :user
25
- # User to get info on
24
+ # @option options [Object] :user
25
+ # User to get info on.
26
26
  # @see https://api.slack.com/methods/users.info
27
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.info.md
28
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.info.json
27
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/users.info.json
29
28
  def users_info(options = {})
30
29
  throw ArgumentError.new('Required arguments :user missing') if options[:user].nil?
31
30
  post('users.info', options)
32
31
  end
33
32
 
34
33
  #
35
- # Lists all users in a Slack team.
34
+ # This method returns a list of all users in the team. This includes deleted/deactivated users.
36
35
  #
36
+ # @option options [Object] :presence
37
+ # Whether to include presence data in the output.
37
38
  # @see https://api.slack.com/methods/users.list
38
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.list.md
39
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.list.json
39
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/users.list.json
40
40
  def users_list(options = {})
41
41
  post('users.list', options)
42
42
  end
43
43
 
44
44
  #
45
- # Marks a user as active.
45
+ # This method lets the slack messaging server know that the authenticated user
46
+ # is currently active. Consult the presence documentation for
47
+ # more details.
46
48
  #
47
49
  # @see https://api.slack.com/methods/users.setActive
48
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.setActive.md
49
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.setActive.json
50
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/users.setActive.json
50
51
  def users_setActive(options = {})
51
52
  post('users.setActive', options)
52
53
  end
53
54
 
54
55
  #
55
- # Manually sets user presence.
56
+ # This method lets you set the calling user's manual presence.
57
+ # Consult the presence documentation for more details.
56
58
  #
57
59
  # @option options [Object] :presence
58
- # Either `auto` or `away`
60
+ # Either auto or away.
59
61
  # @see https://api.slack.com/methods/users.setPresence
60
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.setPresence.md
61
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/users.setPresence.json
62
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/users.setPresence.json
62
63
  def users_setPresence(options = {})
63
64
  throw ArgumentError.new('Required arguments :presence missing') if options[:presence].nil?
64
65
  post('users.setPresence', options)
@@ -5,7 +5,7 @@ require 'erubis'
5
5
  namespace :slack do
6
6
  namespace :web do
7
7
  namespace :api do
8
- # update slack-api-docs from https://github.com/slackhq/slack-api-docs
8
+ # update slack-api-ref from https://github.com/dblock/slack-api-ref
9
9
  task :git_update do
10
10
  sh 'git submodule update --init --recursive'
11
11
  sh 'git submodule foreach git pull origin master'
@@ -14,7 +14,7 @@ namespace :slack do
14
14
  desc 'Update API.'
15
15
  task update: [:git_update] do
16
16
  method_schema = JSON.parse(File.read('lib/slack/web/api/schema/method.json'))
17
- data = Dir.glob('lib/slack/web/api/slack-api-docs/methods/*.json').each_with_object({}) do |path, result|
17
+ data = Dir.glob('lib/slack/web/api/slack-api-ref/methods/*.json').each_with_object({}) do |path, result|
18
18
  name = File.basename(path, '.json')
19
19
  prefix, name = name.split('.')
20
20
  result[prefix] ||= {}
@@ -10,7 +10,9 @@ module Slack
10
10
 
11
11
  <% end %>
12
12
  #
13
- # <%= data["desc"] %>
13
+ <% data["desc"].split("\n").each do |line| %>
14
+ # <%= line %>
15
+ <% end %>
14
16
  #
15
17
  <% data["args"].each do |arg_name, arg_v| %>
16
18
  # @option options [<%= arg_v["type"] %>] :<%= arg_name %>
@@ -23,8 +25,7 @@ module Slack
23
25
  <% end %>
24
26
  <% end %>
25
27
  # @see https://api.slack.com/methods/<%= group %>.<%= name %>
26
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/<%= group %>.<%= name %>.md
27
- # @see https://github.com/slackhq/slack-api-docs/blob/master/methods/<%= group %>.<%= name %>.json
28
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/<%= group %>.<%= name %>.json
28
29
  def <%= group %>_<%= name %>(options = {})
29
30
  <% data["args"].select{|k,v| v["required"]}.each do |arg_name, arg_v| %>
30
31
  throw ArgumentError.new('Required arguments :<%= arg_name %> missing') if options[:<%= arg_name %>].nil?