ruboty-redmine 0.1.4 → 0.1.5

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: 759100cbf0b5752c77f02070110eaf87240727f0
4
- data.tar.gz: e486952501594a90cc2336d14ec24b5985c73c02
3
+ metadata.gz: f7b949437ad33ddc3f084f4935d491f1659a9080
4
+ data.tar.gz: c6b65f85a6ee55633a84d36dbe0ce742132f61c2
5
5
  SHA512:
6
- metadata.gz: d0782d74534eb79f1b85031ae08c9dce588564bb50673784d45028c2137dd612b6cd71a8fdf9d7c254b74d0d7de50e37a475941c7d0897fbac251eb2bc43171a
7
- data.tar.gz: 096427b5f830ba198df16fddb8d63ee90c5a4a8cd3be207be6d3a9247fe9d926e63bd22ba0797fd3a27cacab70d5d23fcde4ecd615d72fe86e32c50550ea90be
6
+ metadata.gz: 67de7f066296931d87e79694ccc5431a1e3c58f043f6819c0888a77332cedfb1cba9f1351d8f02bc4d18219dc2c4d8f7bd97b9ad615203dfdf0cddb3be18b680
7
+ data.tar.gz: 8412ba9bfdaa01495ea3c8ab46b86f98983e395c9e8e11553650e26ed136b1716eeaaf45c48243a396271d3fd22220d9de9f83aa10a3f5c30d780217b1e2a6c9
@@ -8,6 +8,7 @@ module Ruboty
8
8
  env :REDMINE_BASIC_AUTH_USER, 'Basic Auth User', optional: true
9
9
  env :REDMINE_BASIC_AUTH_PASSWORD, 'Basic Auth Password', optional: true
10
10
  env :REDMINE_CHECK_INTERVAL, 'Interval to check new issues', optional: true
11
+ env :REDMINE_HTTP_PROXY, 'HTTP proxy', optional: true
11
12
 
12
13
  on(
13
14
  /create issue (?<rest>.+)/,
@@ -163,7 +164,12 @@ module Ruboty
163
164
  return
164
165
  end
165
166
 
166
- absent_users << u.to_i
167
+ if absent_users.include?(u)
168
+ message.reply("Assigning to #{message[:user]} is already stopped")
169
+ return
170
+ end
171
+
172
+ absent_users << u
167
173
  message.reply("Stop assigning issues to #{u}")
168
174
  end
169
175
 
@@ -174,12 +180,17 @@ module Ruboty
174
180
  return
175
181
  end
176
182
 
177
- absent_users.delete(u.to_i)
183
+ unless absent_users.include?(u)
184
+ message.reply("Assigning to #{message[:user]} is not stopped")
185
+ return
186
+ end
187
+
188
+ absent_users.delete(u)
178
189
  message.reply("Start assigning issues to #{u}")
179
190
  end
180
191
 
181
192
  def list_absent_users(message)
182
- message.reply(absent_users.map(&:to_s).join(", "))
193
+ message.reply(absent_users.map {|id| redmine_id_to_username(id) }.join(", "))
183
194
  end
184
195
 
185
196
  private
@@ -193,8 +204,15 @@ module Ruboty
193
204
  u['chat_name'] == username
194
205
  end
195
206
 
196
- u && u['redmine_id']
207
+ u && u['redmine_id'].to_i
208
+ end
209
+ end
210
+
211
+ def redmine_id_to_username(redmine_id)
212
+ u = users.find do |u|
213
+ u['redmine_id'] == redmine_id.to_i
197
214
  end
215
+ u && u['chat_name']
198
216
  end
199
217
 
200
218
  def redmine
@@ -203,6 +221,7 @@ module Ruboty
203
221
  ENV['REDMINE_API_KEY'],
204
222
  basic_auth_user: ENV['REDMINE_BASIC_AUTH_USER'],
205
223
  basic_auth_password: ENV['REDMINE_BASIC_AUTH_PASSWORD'],
224
+ http_proxy: ENV['REDMINE_HTTP_PROXY'],
206
225
  )
207
226
  end
208
227
 
@@ -86,7 +86,10 @@ module Ruboty
86
86
  private
87
87
 
88
88
  def conn
89
- conn = Faraday.new(url: @url) do |faraday|
89
+ new_options = {url: @url}
90
+ new_options[:proxy] = @options[:http_proxy] if @options[:http_proxy]
91
+
92
+ conn = Faraday.new(new_options) do |faraday|
90
93
  faraday.request :url_encoded
91
94
  faraday.response :logger if ENV['DEBUG']
92
95
  faraday.adapter Faraday.default_adapter
@@ -1,5 +1,5 @@
1
1
  module Ruboty
2
2
  module Redmine
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruboty-redmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryota Arai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-14 00:00:00.000000000 Z
11
+ date: 2016-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruboty
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.4.5
134
+ rubygems_version: 2.5.1
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Redmine plugin for Ruboty