rt-client 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/rt/client.rb +32 -1
- metadata +2 -2
data/rt/client.rb
CHANGED
@@ -103,7 +103,7 @@ class RT_Client
|
|
103
103
|
|
104
104
|
if @cookie.length == 0 or data =~ /401/ # we're not logged in
|
105
105
|
data = site.post @login, :headers => headers
|
106
|
-
puts data
|
106
|
+
# puts data
|
107
107
|
@cookie = data.headers[:set_cookie].to_s.split('; ')[0]
|
108
108
|
# write the new cookie
|
109
109
|
if @cookie !~ /nil/
|
@@ -154,6 +154,37 @@ class RT_Client
|
|
154
154
|
reply
|
155
155
|
end
|
156
156
|
|
157
|
+
# gets a list of ticket links for a ticket.
|
158
|
+
# takes a single parameter containing the ticket id,
|
159
|
+
# and returns a hash of RT Fields => values
|
160
|
+
#
|
161
|
+
# hash = rt.links(822)
|
162
|
+
# hash = rt.links("822")
|
163
|
+
# hash = rt.links("ticket/822")
|
164
|
+
# hash = rt.links(:id => 822)
|
165
|
+
# hash = rt.links(:id => "822")
|
166
|
+
# hash = rt.links(:id => "ticket/822")
|
167
|
+
def links(id)
|
168
|
+
id = id[:id] if id.class == Hash
|
169
|
+
id = id.to_s
|
170
|
+
type = "ticket"
|
171
|
+
sid = id
|
172
|
+
if id =~ /(\w+)\/(.+)/
|
173
|
+
type = $~[1]
|
174
|
+
sid = $~[2]
|
175
|
+
end
|
176
|
+
reply = {}
|
177
|
+
resp = @site["ticket/#{sid}/links/show"].get
|
178
|
+
resp.gsub!(/RT\/\d\.\d\.\d\s\d{3}\s.*\n\n/,"") # toss the HTTP response
|
179
|
+
resp.gsub!(/\n\n/,"\n") # remove double spacing, TMail stops at a blank line
|
180
|
+
return {:error => resp, } if resp =~ /does not exist./
|
181
|
+
th = TMail::Mail.parse(resp)
|
182
|
+
th.each_header do |k,v|
|
183
|
+
reply["#{k}"] = v.to_s
|
184
|
+
end
|
185
|
+
reply
|
186
|
+
end
|
187
|
+
|
157
188
|
# Creates a new ticket. Requires a hash that contains RT form fields as
|
158
189
|
# the keys. Capitalization is important; use :Queue, not :queue. You
|
159
190
|
# will need at least :Queue to create a ticket. For a full list of fields
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rt-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lahti
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-06-01 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|