rt-client 0.8.6 → 0.8.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/rt_client.rb +19 -14
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f0e65dddbdb36ced0b0f265a64643b48d7bafb3
4
- data.tar.gz: efbd10be29bb8a2717b3fb6dbdb4ff5f2eedad3d
3
+ metadata.gz: 38ca6b7422ee833c8520ec0c01795dddb9e2c30f
4
+ data.tar.gz: 76a59c1cba79166eef25485f2b98f1cc4b188c16
5
5
  SHA512:
6
- metadata.gz: fed5c38453ecc893f30c7decec74c3d1ac4ca8a6ca6d211ac0eb8f1936686631b06e4d2d079f66bea463adebc2573e3c563f6de4b15d1096d01dbb3cecba5c91
7
- data.tar.gz: 8d8cf6aeb5ecdffb1fbafd555bb432aec9992cf89fb417a04ab75d8a808698d8f4fc3209ffa9c471364dcd5ea8456d91c78b3061fee82f3210de560b6ca80755
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.6"
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.6"
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].first.split('; ')[0]
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 and
440
- # an optional format parameter. If the format is ommitted, the short
441
- # format is assumed. If the short format is requested, it returns an
442
- # array of 2 element arrays, where each 2-element array is [ticket_id,
443
- # description]. If the long format is requested, it returns an array of
444
- # hashes, where each hash contains the keys:
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
- if comments
485
- h = resp.split("\n").select{ |l| l =~ /^\d+:/ }
486
- else
487
- h = resp.split("\n").select{ |l| l =~ /^\d+: [^Comments]/ }
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.6
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-03-20 00:00:00.000000000 Z
11
+ date: 2015-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client