rt-client 0.3.1 → 0.3.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.
Files changed (2) hide show
  1. data/rt/client.rb +6 -3
  2. metadata +4 -4
data/rt/client.rb CHANGED
@@ -6,6 +6,7 @@ require "tmail"
6
6
  require "iconv"
7
7
  require 'mime/types' # requires both nokogiri and rcov. Yuck.
8
8
  require 'date'
9
+ require 'pp'
9
10
 
10
11
  ##A ruby library API to Request Tracker's REST interface. Requires the
11
12
  ##rubygems rest-client, tmail and mime-types to be installed. You can
@@ -21,7 +22,7 @@ require 'date'
21
22
 
22
23
  class RT_Client
23
24
 
24
- UA = "Mozilla/5.0 ruby RT Client Interface 0.3.1"
25
+ UA = "Mozilla/5.0 ruby RT Client Interface 0.3.2"
25
26
  attr_reader :status, :site, :version, :cookies, :server, :user, :cookie
26
27
 
27
28
  # Create a new RT_Client object. Load up our stored cookie and check it.
@@ -54,7 +55,7 @@ class RT_Client
54
55
  # cookies=<directory>
55
56
  def initialize(*params)
56
57
  @boundary = "----xYzZY#{rand(1000000).to_s}xYzZY"
57
- @version = "0.3"
58
+ @version = "0.3.2"
58
59
  @status = "Not connected"
59
60
  @server = "http://localhost/"
60
61
  @user = "rt_user"
@@ -205,6 +206,8 @@ class RT_Client
205
206
  def create(field_hash)
206
207
  field_hash[:id] = "ticket/new"
207
208
  payload = compose(field_hash)
209
+ puts "Payload for new ticket:"
210
+ puts payload
208
211
  resp = @site['ticket/new/edit'].post payload
209
212
  new_id = resp.match(/Ticket\s*(\d+)/)
210
213
  if new_id.class == MatchData
@@ -743,6 +746,7 @@ class RT_Client
743
746
  # attachments
744
747
  if fields.has_key? :Attachments
745
748
  fields[:Attachment] = fields[:Attachments]
749
+ fields.delete :Attachments
746
750
  end
747
751
  if fields.has_key? :Attachment
748
752
  filenames = fields[:Attachment].split(',')
@@ -762,7 +766,6 @@ class RT_Client
762
766
  # strip paths from filenames
763
767
  fields[:Attachment] = filenames.map {|f| File.basename(f)}.join(',')
764
768
  end
765
-
766
769
  field_array = fields.map { |k,v| "#{k}: #{v}" }
767
770
  content = field_array.join("\n") # our form
768
771
  # add the form to the end of any attachments
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rt-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 1
10
- version: 0.3.1
9
+ - 2
10
+ version: 0.3.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Lahti
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-30 00:00:00 -07:00
18
+ date: 2010-08-14 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency