slack-ruby-client 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e1cd2d1d9cbc3663ae0616b48855f34454e8ad4
4
- data.tar.gz: 0e7cc755aa5623005a60d5e2d7d62a8c70596bdb
3
+ metadata.gz: df64328580f69c890ab8fabff98767786d92b37a
4
+ data.tar.gz: 4c5ced46b270d5e67295043384bf598cb743c985
5
5
  SHA512:
6
- metadata.gz: 3080aca20cc3a8d3f2d873f9192842806db73f18297e0b41784f5bd3d028d18eabda168331b1f3d883a1699c39f1776adf3a6d5a0881b402408b480f3156c6fd
7
- data.tar.gz: a8b263005432280abf2b89f6d2495eb63890024336ea2d9f19e04d2078c0c45704acdbda38cb018b75d5afd651ae226b9dbe6e7189d2e6caf5e26d33ad0a3fba
6
+ metadata.gz: 64ca4a04c88a505476b2142fc5054d2560f79ce1fc82303631b5a5baeeab54456ed1edbcfe170489233a0c6e362d83ea1661b3dde3f248ea0d283fc17c9cf8f8
7
+ data.tar.gz: afacac026a07847c3f4a0e79f8944d7f2a3d2442f7dad8c46cb1b39740749d6a30b6805769d59f17bf517fc100f01e5cc777eb30a7cd13f84f8f5b727bbb6590
@@ -23,3 +23,7 @@ matrix:
23
23
 
24
24
  git:
25
25
  submodules: false
26
+
27
+ before_install:
28
+ - gem update bundler
29
+ - gem update --system
@@ -1,3 +1,9 @@
1
+ ### 0.7.4 (5/28/2016)
2
+
3
+ * [#93](https://github.com/dblock/slack-ruby-client/pull/93): Fix: When using Celluloid concurrency, handle input from the TCP socket asynchronously from reading more. - [@benzrf](https://github.com/benzrf).
4
+ * Added `auth_revoke` and `users_identity` to Web API - [@dblock](https://github.com/dblock).
5
+ * Added `channel` parameter to `files_comments_add` Web API - [@dblock](https://github.com/dblock).
6
+
1
7
  ### 0.7.3 (5/14/2016)
2
8
 
3
9
  * [#90](https://github.com/dblock/slack-ruby-client/issues/90): Fix: Celluloid concurrency handles server-side connection closing - [@dblock](https://github.com/dblock).
data/README.md CHANGED
@@ -5,7 +5,7 @@ Slack Ruby Client
5
5
  [![Build Status](https://travis-ci.org/dblock/slack-ruby-client.svg?branch=master)](https://travis-ci.org/dblock/slack-ruby-client)
6
6
  [![Code Climate](https://codeclimate.com/github/dblock/slack-ruby-client/badges/gpa.svg)](https://codeclimate.com/github/dblock/slack-ruby-client)
7
7
 
8
- A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messaging](https://api.slack.com/rtm) APIs. Comes with a handy command-line client, too.
8
+ A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messaging](https://api.slack.com/rtm) APIs. Comes with a handy command-line client, too. If you are not familiar with these concepts, you might want to watch [this video](http://code.dblock.org/2016/03/11/your-first-slack-bot-service-video.html).
9
9
 
10
10
  ![](slack.png)
11
11
 
@@ -18,7 +18,7 @@ A Ruby client for the Slack [Web](https://api.slack.com/web) and [RealTime Messa
18
18
 
19
19
  ## Stable Release
20
20
 
21
- You're reading the documentation for the **next** release of slack-ruby-client. Please see the documentation for the [last stable release, v0.7.2](https://github.com/dblock/slack-ruby-client/blob/v0.7.2/README.md) unless you're integrating with HEAD. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
21
+ You're reading the documentation for the **stable** release of slack-ruby-client, 0.7.4. See [UPGRADING](UPGRADING.md) when upgrading from an older version.
22
22
 
23
23
  ## Installation
24
24
 
@@ -2,6 +2,15 @@
2
2
 
3
3
  desc 'Auth methods.'
4
4
  command 'auth' do |g|
5
+ g.desc '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.'
6
+ g.long_desc %( 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. )
7
+ g.command 'revoke' do |c|
8
+ c.flag 'test', desc: 'Setting this parameter to 1 triggers a testing mode where the specified token will not actually be revoked.'
9
+ c.action do |_global_options, options, _args|
10
+ puts JSON.dump($client.auth_revoke(options))
11
+ end
12
+ end
13
+
5
14
  g.desc 'This method checks authentication and tells you who you are.'
6
15
  g.long_desc %( This method checks authentication and tells you who you are. )
7
16
  g.command 'test' do |c|
@@ -13,11 +13,11 @@ command 'chat' do |g|
13
13
  end
14
14
  end
15
15
 
16
- g.desc 'This method posts a message to a public channel, private group, or IM channel.'
17
- g.long_desc %( This method posts a message to a public channel, private group, or IM channel. )
16
+ g.desc 'This method posts a message to a public channel, private channel, or direct message/IM channel.'
17
+ g.long_desc %( This method posts a message to a public channel, private channel, or direct message/IM channel. )
18
18
  g.command 'postMessage' do |c|
19
19
  c.flag 'channel', desc: 'Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.'
20
- c.flag 'text', desc: 'Text of the message to send. See below for an explanation of formatting.'
20
+ c.flag 'text', desc: "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."
21
21
  c.flag 'parse', desc: 'Change how messages are treated. Defaults to none. See below.'
22
22
  c.flag 'link_names', desc: 'Find and link channel names and usernames.'
23
23
  c.flag 'attachments', desc: 'Structured message attachments.'
@@ -30,7 +30,7 @@ command 'files' do |g|
30
30
  c.flag 'types', desc: 'Filter files by type:
31
31
 
32
32
  all - All files
33
- posts - Posts
33
+ spaces - Posts
34
34
  snippets - Snippets
35
35
  images - Image files
36
36
  gdocs - Google docs
@@ -38,7 +38,7 @@ zips - Zip files
38
38
  pdfs - PDF files
39
39
 
40
40
 
41
- You can pass multiple values in the types argument, like types=posts,snippets.The default value is all, which does not filter the list.
41
+ You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list.
42
42
  .'
43
43
  c.action do |_global_options, options, _args|
44
44
  puts JSON.dump($client.files_list(options))
@@ -7,6 +7,7 @@ command 'files_comments' do |g|
7
7
  g.command 'add' do |c|
8
8
  c.flag 'file', desc: 'File to add a comment to.'
9
9
  c.flag 'comment', desc: 'Text of the comment to add.'
10
+ c.flag 'channel', desc: 'Channel id (encoded) of which location to associate with the new comment.'
10
11
  c.action do |_global_options, options, _args|
11
12
  puts JSON.dump($client.files_comments_add(options))
12
13
  end
@@ -11,6 +11,14 @@ command 'users' do |g|
11
11
  end
12
12
  end
13
13
 
14
+ g.desc "After your Slack app is awarded an identity token through Sign in with Slack, use this method to retrieve a user's identity."
15
+ g.long_desc %( After your Slack app is awarded an identity token through Sign in with Slack, use this method to retrieve a user's identity. )
16
+ g.command 'identity' do |c|
17
+ c.action do |_global_options, options, _args|
18
+ puts JSON.dump($client.users_identity(options))
19
+ end
20
+ end
21
+
14
22
  g.desc 'This method returns information about a team member.'
15
23
  g.long_desc %( This method returns information about a team member. )
16
24
  g.command 'info' do |c|
@@ -47,6 +47,10 @@ module Slack
47
47
 
48
48
  def read
49
49
  buffer = socket.readpartial(BLOCK_SIZE)
50
+ async.handle_read(buffer)
51
+ end
52
+
53
+ def handle_read(buffer)
50
54
  logger.debug("#{self.class}##{__method__}") { buffer }
51
55
  driver.parse buffer
52
56
  end
@@ -1,3 +1,3 @@
1
1
  module Slack
2
- VERSION = '0.7.3'.freeze
2
+ VERSION = '0.7.4'.freeze
3
3
  end
@@ -5,6 +5,17 @@ module Slack
5
5
  module Api
6
6
  module Endpoints
7
7
  module Auth
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.
10
+ #
11
+ # @option options [Object] :test
12
+ # Setting this parameter to 1 triggers a testing mode where the specified token will not actually be revoked.
13
+ # @see https://api.slack.com/methods/auth.revoke
14
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/auth/auth.revoke.json
15
+ def auth_revoke(options = {})
16
+ post('auth.revoke', options)
17
+ end
18
+
8
19
  #
9
20
  # This method checks authentication and tells you who you are.
10
21
  #
@@ -24,12 +24,12 @@ module Slack
24
24
  end
25
25
 
26
26
  #
27
- # This method posts a message to a public channel, private group, or IM channel.
27
+ # This method posts a message to a public channel, private channel, or direct message/IM channel.
28
28
  #
29
29
  # @option options [channel] :channel
30
30
  # Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
31
31
  # @option options [Object] :text
32
- # Text of the message to send. See below for an explanation of formatting.
32
+ # 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.
33
33
  # @option options [Object] :parse
34
34
  # Change how messages are treated. Defaults to none. See below.
35
35
  # @option options [Object] :link_names
@@ -44,7 +44,7 @@ module Slack
44
44
  # Filter files by type:
45
45
  #
46
46
  # all - All files
47
- # posts - Posts
47
+ # spaces - Posts
48
48
  # snippets - Snippets
49
49
  # images - Image files
50
50
  # gdocs - Google docs
@@ -52,7 +52,7 @@ module Slack
52
52
  # pdfs - PDF files
53
53
  #
54
54
  #
55
- # You can pass multiple values in the types argument, like types=posts,snippets.The default value is all, which does not filter the list.
55
+ # You can pass multiple values in the types argument, like types=spaces,snippets.The default value is all, which does not filter the list.
56
56
  # .
57
57
  # @see https://api.slack.com/methods/files.list
58
58
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files/files.list.json
@@ -12,11 +12,14 @@ module Slack
12
12
  # File to add a comment to.
13
13
  # @option options [Object] :comment
14
14
  # Text of the comment to add.
15
+ # @option options [channel] :channel
16
+ # Channel id (encoded) of which location to associate with the new comment.
15
17
  # @see https://api.slack.com/methods/files.comments.add
16
18
  # @see https://github.com/dblock/slack-api-ref/blob/master/methods/files.comments/files.comments.add.json
17
19
  def files_comments_add(options = {})
18
20
  throw ArgumentError.new('Required arguments :file missing') if options[:file].nil?
19
21
  throw ArgumentError.new('Required arguments :comment missing') if options[:comment].nil?
22
+ options = options.merge(channel: channels_id(options)['channel']['id']) if options[:channel]
20
23
  post('files.comments.add', options)
21
24
  end
22
25
 
@@ -19,6 +19,15 @@ module Slack
19
19
  post('users.getPresence', options)
20
20
  end
21
21
 
22
+ #
23
+ # After your Slack app is awarded an identity token through Sign in with Slack, use this method to retrieve a user's identity.
24
+ #
25
+ # @see https://api.slack.com/methods/users.identity
26
+ # @see https://github.com/dblock/slack-api-ref/blob/master/methods/users/users.identity.json
27
+ def users_identity(options = {})
28
+ post('users.identity', options)
29
+ end
30
+
22
31
  #
23
32
  # This method returns information about a team member.
24
33
  #
@@ -9,7 +9,7 @@ RSpec.describe Slack::Web::Api::Endpoints::FilesComments do
9
9
  expect { client.files_comments_add(comment: 'Everyone should take a moment to read this file.') }.to raise_error ArgumentError, /Required arguments :file missing/
10
10
  end
11
11
  it 'requires comment' do
12
- expect { client.files_comments_add(file: 'F1234567890') }.to raise_error ArgumentError, /Required arguments :comment missing/
12
+ expect { client.files_comments_add(file: 'F1234467890') }.to raise_error ArgumentError, /Required arguments :comment missing/
13
13
  end
14
14
  end
15
15
  context 'files.comments_delete' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-14 00:00:00.000000000 Z
11
+ date: 2016-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport