Patch #1724 » rdm-mailhandler.rb.patch
rdm-mailhandler.rb (working copy) | ||
---|---|---|
9 | 9 |
require 'uri' |
10 | 10 |
require 'getoptlong' |
11 | 11 | |
12 |
# easy way to use https |
|
13 |
# from http://www.missiondata.com/blog/ruby/65/building-a-better-world-with-google-spreadsheets/ |
|
14 |
module Net |
|
15 |
class HTTPS < HTTP |
|
16 |
def initialize(address, port = nil) |
|
17 |
super(address, port) |
|
18 |
self.use_ssl = true |
|
19 |
end |
|
20 |
end |
|
21 |
end |
|
22 | ||
23 | ||
12 | 24 |
class RedmineMailHandler |
13 | 25 |
VERSION = '0.1' |
14 | 26 |
|
... | ... | |
59 | 71 |
issue_attributes.each { |attr, value| data["issue[#{attr}]"] = value } |
60 | 72 |
|
61 | 73 |
debug "Posting to #{uri}..." |
62 |
response = Net::HTTP.post_form(URI.parse(uri), data) |
|
74 |
if url =~ /^https/ |
|
75 |
response = Net::HTTPS.post_form(URI.parse(uri), data) |
|
76 |
else |
|
77 |
response = Net::HTTP.post_form(URI.parse(uri), data) |
|
78 |
end |
|
63 | 79 |
debug "Response received: #{response.code}" |
64 | 80 |
response.code == 201 ? 0 : 1 |
65 | 81 |
end |
- « Previous
- 1
- 2
- Next »