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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9dc29f6cef0ea1e5e3886e70d33f4d9e5731e086f70d39088a995a9367dc27cb
4
- data.tar.gz: 128bbc4de539fa9abe0b227fbdc0f152fc66b815cd1c73164215bc11381e350f
3
+ metadata.gz: 8e8844797bbc88f71e3e67b3e7c428da8f6435de38447284ef8fbf96c53d7d0e
4
+ data.tar.gz: 0a77ab41f21d5ed9fbc057a006d88b056a10f4726fe175cd3f263ad4d39f4db1
5
5
  SHA512:
6
- metadata.gz: deb25f3219be6672b16552d48aeb855dcffb24a0df7b4ecc97bf489b73f0e3963ae559f26e40fc1b72c8214033922c9498554d5d416eb1507dc05cb76e865c4d
7
- data.tar.gz: 7df223ed0d7cfbc57e932a4534a3ff37796db4d67f6d5490d59ddb109ba040279f3d01502013fca31909dc31ef971ad7c5393af94eaad5ab5fbd3ff94acd57c9
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 = null
88
- @realtime = null
98
+ @url = nil
99
+ @realtime = nil
89
100
  end
90
101
  end
91
102
 
@@ -1,5 +1,5 @@
1
1
  require 'ruboty/slack_rtm/version'
2
2
  require 'ruboty/slack_rtm/client'
3
3
  require 'ruboty/adapters/slack_rtm'
4
- require_relative 'robot'
5
- require_relative 'message'
4
+ require 'ruboty/slack_rtm/robot'
5
+ require 'ruboty/slack_rtm/message'
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module SlackRTM
3
- VERSION = '2.9.0'
3
+ VERSION = '3.0.0'
4
4
  end
5
5
  end
@@ -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', '~> 11.1'
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: 2.9.0
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-02-23 00:00:00.000000000 Z
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: '11.1'
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: '11.1'
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
@@ -1,9 +0,0 @@
1
- module Ruboty
2
- class Message
3
- def add_reaction(reaction)
4
- channel_id = @original[:channel]["id"]
5
- timestamp = @original[:time].to_f
6
- robot.add_reaction(reaction, channel_id, timestamp)
7
- end
8
- end
9
- end
@@ -1,10 +0,0 @@
1
- module Ruboty
2
- class Robot
3
- delegate :add_reaction, to: :adapter
4
-
5
- def add_reaction(reaction, channel_id, timestamp)
6
- adapter.add_reaction(reaction, channel_id, timestamp)
7
- true
8
- end
9
- end
10
- end