roart 0.1.5 → 0.1.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ ==0.1.5.1 / 2010-01-20
2
+ Fixed a bug that caused custom fields not to show up in the ticket attributes
3
+
1
4
  ==0.1.5 / 2010-01-19
2
5
  Can add transactions ticket using #comment method. (via btucker)
3
6
  Can authenticate again after the Ticket class is declared. (via newellista)
data/lib/roart.rb CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  module Roart
3
3
 
4
4
  # :stopdoc:
5
- VERSION = '0.1.5'
5
+ VERSION = '0.1.5.1'
6
6
  LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
7
7
  PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
8
8
  # :startdoc:
@@ -1,7 +1,7 @@
1
1
  module Roart
2
-
2
+
3
3
  module TicketPage
4
-
4
+
5
5
  IntKeys = %w[id]
6
6
 
7
7
  def to_hash
@@ -9,19 +9,20 @@ module Roart
9
9
  self.delete_if{|x| !x.include?(":")}
10
10
  self.each do |ln|
11
11
  ln = ln.split(":")
12
+ key = nil
12
13
  if ln[0] && ln[0].match(/^CF-.+/)
13
14
  key = ln.delete_at(0)
14
15
  key = "cf_" + key[3..key.length].gsub(/ /, "_")
15
16
  else
16
17
  key = ln.delete_at(0).strip.underscore
17
- value = ln.join(":").strip
18
- hash[key.to_sym] = value
19
18
  end
19
+ value = ln.join(":").strip
20
+ hash[key.to_sym] = value if key
20
21
  end
21
22
  hash[:id] = hash[:id].split("/").last.to_i
22
23
  hash
23
24
  end
24
-
25
+
25
26
  def to_search_array
26
27
  array = Array.new
27
28
  self.delete_if{|x| !x.include?(":")}
@@ -59,7 +60,7 @@ module Roart
59
60
  end
60
61
  hash
61
62
  end
62
-
63
+
63
64
  end
64
-
65
+
65
66
  end
@@ -14,6 +14,24 @@ describe 'ticket page' do
14
14
  end
15
15
 
16
16
  end
17
+
18
+ describe 'reading a ticket' do
19
+
20
+ before do
21
+ @page = File.open(File.join(File.dirname(__FILE__), %w[ .. test_data ticket.txt])).readlines.join
22
+ @page = @page.split("\n")
23
+ @page.extend(Roart::TicketPage)
24
+ end
25
+
26
+ it 'should include custom fields' do
27
+ @page.to_hash[:cf_BTN].should == '1035328269'
28
+ end
29
+
30
+ it 'should be a hash' do
31
+ @page.to_hash.class.should == Hash
32
+ end
33
+
34
+ end
17
35
 
18
36
  describe 'search array' do
19
37
 
@@ -0,0 +1,31 @@
1
+ RT/3.6.6 200 Ok
2
+
3
+ id: ticket/358171
4
+ Queue: MyQueue
5
+ Owner: some_guy
6
+ Creator: some_guy
7
+ Subject: MyQueue - some_guy - 1035328269 - DSL Modem Reset ESCALATED
8
+ Status: open
9
+ Priority: 1
10
+ InitialPriority: 1
11
+ FinalPriority: 10
12
+ Requestors: some_guy@MyQueue.net
13
+ Cc:
14
+ AdminCc:
15
+ Created: Sat Jan 16 14:40:38 2010
16
+ Starts: Not set
17
+ Started: Sat Jan 16 14:40:40 2010
18
+ Due: Mon Jan 18 20:40:38 2010
19
+ Resolved: Not set
20
+ Told: Not set
21
+ LastUpdated: Sat Jan 16 14:50:17 2010
22
+ TimeEstimated: 0
23
+ TimeWorked: 0
24
+ TimeLeft: 0
25
+ CF-BTN: 1035328269
26
+ CF-Call Back Status:
27
+ CF-Call Back Time:
28
+ CF-Contact Name: some_guy
29
+ CF-Contact Phone:
30
+ CF-CMSID:
31
+ CF-IssueCategory: DSL - Modem/Router Config
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - PJ Davis
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-19 00:00:00 -06:00
12
+ date: 2010-01-20 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -43,6 +43,7 @@ extra_rdoc_files:
43
43
  - README.rdoc
44
44
  - spec/test_data/full_history.txt
45
45
  - spec/test_data/single_history.txt
46
+ - spec/test_data/ticket.txt
46
47
  files:
47
48
  - History.txt
48
49
  - README.rdoc
@@ -76,6 +77,7 @@ files:
76
77
  - spec/spec_helper.rb
77
78
  - spec/test_data/full_history.txt
78
79
  - spec/test_data/single_history.txt
80
+ - spec/test_data/ticket.txt
79
81
  - tasks/ann.rake
80
82
  - tasks/bones.rake
81
83
  - tasks/gem.rake