rt-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 +4 -4
- data/rt_client.rb +16 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c4fced7d3efdfc2bce79c8e560176e52d8ae6df5
|
4
|
+
data.tar.gz: a55fa908b9e3720d11fb942244404052fe7fc6f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db916782f65a180792f7376310cb11c528aa5f451d6d90d92ebacc30e3007b226a17b600589f2335329f1fb2959fb9a9e2583cade4dfcac7203eda2534fb4c27
|
7
|
+
data.tar.gz: 86448e3a01d3817414f5d16499705c728ec6fdb8e30e64604aaf578e6c238e72d1f8e532ab7b2f411982ea5c2455e2fc713279417b380e6736452d86cc40d8c7
|
data/rt_client.rb
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
require "rubygems"
|
4
4
|
require "rest_client"
|
5
|
+
if (RUBY_VERSION.to_f < 1.9)
|
6
|
+
require 'iconv'
|
7
|
+
end
|
5
8
|
|
6
9
|
## Author:: Tom Lahti
|
7
10
|
## Copyright:: Copyright (c) 2013 Tom Lahti
|
@@ -34,7 +37,7 @@ require "rest_client"
|
|
34
37
|
|
35
38
|
class RT_Client
|
36
39
|
|
37
|
-
UA = "Mozilla/5.0 ruby RT Client Interface 0.7.
|
40
|
+
UA = "Mozilla/5.0 ruby RT Client Interface 0.7.4"
|
38
41
|
attr_reader :status, :site, :version, :cookies, :server, :user, :cookie
|
39
42
|
|
40
43
|
# Create a new RT_Client object. Load up our stored cookie and check it.
|
@@ -67,7 +70,7 @@ class RT_Client
|
|
67
70
|
# cookies=<directory>
|
68
71
|
def initialize(*params)
|
69
72
|
@boundary = "----xYzZY#{rand(1000000).to_s}xYzZY"
|
70
|
-
@version = "0.7.
|
73
|
+
@version = "0.7.4"
|
71
74
|
@status = "Not connected"
|
72
75
|
@server = "http://localhost/"
|
73
76
|
@user = "rt_user"
|
@@ -519,6 +522,12 @@ class RT_Client
|
|
519
522
|
s[:size] = sz[2].to_s
|
520
523
|
end
|
521
524
|
attachments.push s
|
525
|
+
if s[:name] == 'untitled' # this is the content in HTML, I hope
|
526
|
+
unt_att = get_attachment(id,s[:id])
|
527
|
+
if (unt_att["contenttype"] == 'text/html') # hurray
|
528
|
+
reply["content_html"] = sterilize(unt_att["content"])
|
529
|
+
end
|
530
|
+
end
|
522
531
|
end
|
523
532
|
reply["attachments"] = attachments
|
524
533
|
end
|
@@ -689,7 +698,11 @@ class RT_Client
|
|
689
698
|
content.chomp!
|
690
699
|
content.chomp!
|
691
700
|
content.chomp! # 3 carriage returns at the end
|
692
|
-
|
701
|
+
if (RUBY_VERSION.to_f >= 1.9)
|
702
|
+
binary = content.encode("ISO-8859-1","UTF-8", { :invalid => :replace, :undef => :replace })
|
703
|
+
else
|
704
|
+
binary = Iconv.conv("ISO-8859-1","UTF-8",content) # convert encoding
|
705
|
+
end
|
693
706
|
if dir
|
694
707
|
fh = File.new("#{dir}/#{headers['Filename'].to_s}","wb")
|
695
708
|
fh.write binary
|