rt-client 0.8.6 → 0.8.7
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 +19 -14
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38ca6b7422ee833c8520ec0c01795dddb9e2c30f
|
4
|
+
data.tar.gz: 76a59c1cba79166eef25485f2b98f1cc4b188c16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96e835cfb0a8aeb9a40c6df5ad4429fdc05b2c572af6237a4dbbb92519581879838d12baa402f77c6a9be784c5121190e1f6131e72ba63c19b20117168ca61a1
|
7
|
+
data.tar.gz: c6ad41b58a19c8e24f82e65cd81d8606014bac136665a50a9a299ee7a6462b98947062692ebc3b64a44636e2b6a63f2903fd202618e3b5096d476962cf1e6b60
|
data/rt_client.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#!/usr/local/src/rubinius-2.2.7/bin/rbx
|
2
1
|
#!/usr/bin/ruby
|
3
2
|
|
4
3
|
require "rubygems"
|
@@ -7,6 +6,8 @@ if (RUBY_VERSION.to_f < 1.9)
|
|
7
6
|
require 'iconv'
|
8
7
|
end
|
9
8
|
|
9
|
+
require 'pp'
|
10
|
+
|
10
11
|
## Author:: Tom Lahti
|
11
12
|
## Copyright:: Copyright (c) 2013 Tom Lahti
|
12
13
|
## License:: Apache 2.0
|
@@ -37,7 +38,7 @@ end
|
|
37
38
|
|
38
39
|
class RT_Client
|
39
40
|
|
40
|
-
UA = "Mozilla/5.0 ruby RT Client Interface 0.8.
|
41
|
+
UA = "Mozilla/5.0 ruby RT Client Interface 0.8.7"
|
41
42
|
attr_reader :status, :site, :version, :cookies, :server, :user, :cookie
|
42
43
|
|
43
44
|
# Create a new RT_Client object. Load up our stored cookie and check it.
|
@@ -70,7 +71,7 @@ class RT_Client
|
|
70
71
|
# cookies=<directory>
|
71
72
|
def initialize(*params)
|
72
73
|
@boundary = "----xYzZY#{rand(1000000).to_s}xYzZY"
|
73
|
-
@version = "0.8.
|
74
|
+
@version = "0.8.7"
|
74
75
|
@status = "Not connected"
|
75
76
|
@server = "http://localhost/"
|
76
77
|
@user = "rt_user"
|
@@ -120,7 +121,7 @@ class RT_Client
|
|
120
121
|
if @cookie.length == 0 or data =~ /401/ # we're not logged in
|
121
122
|
data = site.post @login, :headers => headers
|
122
123
|
# puts data
|
123
|
-
@cookie = data.headers[:set_cookie].
|
124
|
+
@cookie = data.headers[:set_cookie].split('; ')[0]
|
124
125
|
# write the new cookie
|
125
126
|
if @cookie !~ /nil/
|
126
127
|
f = File.new(cookiejar,"w")
|
@@ -436,12 +437,16 @@ class RT_Client
|
|
436
437
|
replies
|
437
438
|
end
|
438
439
|
|
439
|
-
# Get a list of history transactions for a ticket. Takes a ticket ID
|
440
|
-
# an optional format parameter
|
441
|
-
# format is
|
442
|
-
# array of 2 element arrays, where
|
443
|
-
# description]. If the long format
|
444
|
-
# hashes, where each hash contains
|
440
|
+
# Get a list of history transactions for a ticket. Takes a ticket ID,
|
441
|
+
# an optional format parameter, and a optional comments parameter. If
|
442
|
+
# the format is ommitted, the short format is assumed. If the short
|
443
|
+
# format is requested, it returns an array of 2 element arrays, where
|
444
|
+
# each 2-element array is [ticket_id, description]. If the long format
|
445
|
+
# is requested, it returns an array of hashes, where each hash contains
|
446
|
+
# the keys listed below. If the optional 'comments' parameter is supplied
|
447
|
+
# and set to 'true', comments are included in the list of history items.
|
448
|
+
# If 'comments' is omitted, it is assumed to be 'false' and all history
|
449
|
+
# items related to comments are stripped from the response.
|
445
450
|
#
|
446
451
|
# id:: (history-id)
|
447
452
|
# Ticket:: (Ticket this history item belongs to)
|
@@ -481,10 +486,10 @@ class RT_Client
|
|
481
486
|
resp = sterilize(resp)
|
482
487
|
|
483
488
|
if format[0,1] == "s"
|
484
|
-
|
485
|
-
h
|
486
|
-
|
487
|
-
h
|
489
|
+
h = resp.split("\n")
|
490
|
+
h.select!{ |l| l =~ /^\d+:/ }
|
491
|
+
if not comments
|
492
|
+
h.select!{ |l| l !~ /^\d+: Comments/ }
|
488
493
|
h.select!{ |l| l !~ /Outgoing email about a comment/ }
|
489
494
|
end
|
490
495
|
list = h.map { |l| l.split(":") }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rt-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lahti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|