ruboty-slack_rtm 2.9.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ruboty/adapters/slack_rtm.rb +13 -2
- data/lib/ruboty/slack_rtm.rb +2 -2
- data/lib/ruboty/slack_rtm/message.rb +15 -0
- data/lib/ruboty/slack_rtm/robot.rb +16 -0
- data/lib/ruboty/slack_rtm/version.rb +1 -1
- data/ruboty-slack_rtm.gemspec +2 -1
- metadata +20 -6
- data/lib/ruboty/message.rb +0 -9
- data/lib/ruboty/robot.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e8844797bbc88f71e3e67b3e7c428da8f6435de38447284ef8fbf96c53d7d0e
|
4
|
+
data.tar.gz: 0a77ab41f21d5ed9fbc057a006d88b056a10f4726fe175cd3f263ad4d39f4db1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54067fd413c3e1b5f7c808697938f0624499841e6451344e1e92af1668d45626e367bf1daaac2a529a76ce0c4477234b63fc0b09e0adf41201e601f3dcdd4821
|
7
|
+
data.tar.gz: 00b247b0f7e7259618030e364e3159f58132e342eb5b488115d996788dd6541e1aed3c6660f0991fd8405c8292a44d4cfe2445e2c6caa0cb00b4ad9d583ff1b3
|
@@ -3,6 +3,7 @@ require 'time'
|
|
3
3
|
require 'json'
|
4
4
|
require 'slack'
|
5
5
|
require 'ruboty/adapters/base'
|
6
|
+
require 'faraday'
|
6
7
|
|
7
8
|
module Ruboty
|
8
9
|
module Adapters
|
@@ -37,6 +38,16 @@ module Ruboty
|
|
37
38
|
as_user: true,
|
38
39
|
attachments: message[:attachments].to_json
|
39
40
|
)
|
41
|
+
elsif message[:file]
|
42
|
+
path = message[:file][:path]
|
43
|
+
client.files_upload(
|
44
|
+
channels: channel,
|
45
|
+
as_user: true,
|
46
|
+
file: Faraday::UploadIO.new(path, message[:file][:content_type]),
|
47
|
+
title: message[:file][:title] || path,
|
48
|
+
filename: File.basename(path),
|
49
|
+
initial_comment: message[:body] || ''
|
50
|
+
)
|
40
51
|
else
|
41
52
|
realtime.send_message(
|
42
53
|
type: 'message',
|
@@ -84,8 +95,8 @@ module Ruboty
|
|
84
95
|
loop do
|
85
96
|
realtime.main_loop rescue nil
|
86
97
|
break unless ENV['SLACK_AUTO_RECONNECT']
|
87
|
-
@url =
|
88
|
-
@realtime =
|
98
|
+
@url = nil
|
99
|
+
@realtime = nil
|
89
100
|
end
|
90
101
|
end
|
91
102
|
|
data/lib/ruboty/slack_rtm.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'ruboty/message'
|
2
|
+
|
3
|
+
module Ruboty
|
4
|
+
module SlackRTM
|
5
|
+
module Message
|
6
|
+
def add_reaction(reaction)
|
7
|
+
channel_id = @original[:channel]["id"]
|
8
|
+
timestamp = @original[:time].to_f
|
9
|
+
robot.add_reaction(reaction, channel_id, timestamp)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
Message.include SlackRTM::Message
|
15
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'ruboty/robot'
|
2
|
+
|
3
|
+
module Ruboty
|
4
|
+
module SlackRTM
|
5
|
+
module Robot
|
6
|
+
delegate :add_reaction, to: :adapter
|
7
|
+
|
8
|
+
def add_reaction(reaction, channel_id, timestamp)
|
9
|
+
adapter.add_reaction(reaction, channel_id, timestamp)
|
10
|
+
true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
Robot.include SlackRTM::Robot
|
16
|
+
end
|
data/ruboty-slack_rtm.gemspec
CHANGED
@@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
22
|
-
spec.add_development_dependency 'rake', '~>
|
22
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
23
23
|
spec.add_development_dependency 'rubocop', '>= 0.28.0'
|
24
24
|
|
25
25
|
spec.add_dependency 'ruboty', '>= 1.1.4'
|
26
26
|
spec.add_dependency 'slack-api', '~> 1.6'
|
27
27
|
spec.add_dependency 'websocket-client-simple', '~> 0.3.0'
|
28
|
+
spec.add_dependency 'faraday', '~> 0.11'
|
28
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-slack_rtm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 0.3.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: faraday
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.11'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.11'
|
97
111
|
description: Slack real time messaging adapter for Ruboty
|
98
112
|
email:
|
99
113
|
- rosylilly@aduca.org
|
@@ -108,10 +122,10 @@ files:
|
|
108
122
|
- README.md
|
109
123
|
- Rakefile
|
110
124
|
- lib/ruboty/adapters/slack_rtm.rb
|
111
|
-
- lib/ruboty/message.rb
|
112
|
-
- lib/ruboty/robot.rb
|
113
125
|
- lib/ruboty/slack_rtm.rb
|
114
126
|
- lib/ruboty/slack_rtm/client.rb
|
127
|
+
- lib/ruboty/slack_rtm/message.rb
|
128
|
+
- lib/ruboty/slack_rtm/robot.rb
|
115
129
|
- lib/ruboty/slack_rtm/version.rb
|
116
130
|
- ruboty-slack_rtm.gemspec
|
117
131
|
homepage: https://github.com/rosylilly/ruboty-slack_rtm
|
data/lib/ruboty/message.rb
DELETED