trac4r 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/trac4r/query.rb +1 -2
- data/lib/trac4r/ticket.rb +15 -0
- metadata +1 -1
data/lib/trac4r/query.rb
CHANGED
@@ -51,8 +51,7 @@ module Trac
|
|
51
51
|
return @connection.call(command,*args)
|
52
52
|
rescue => e
|
53
53
|
if e.message =~ /HTTP-Error/
|
54
|
-
|
55
|
-
raise TracException.new(errorcode,@host,@port,@path,command,args)
|
54
|
+
raise TracException.new(e.message,@host,@port,@path,command,args)
|
56
55
|
else
|
57
56
|
raise
|
58
57
|
end
|
data/lib/trac4r/ticket.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module Trac
|
2
2
|
# This class represents a ticket as it is retrieved from the database
|
3
|
+
# Custom fields are detected and available via runtime-dispatched methods.
|
4
|
+
# See +method_missing+
|
3
5
|
class Ticket
|
4
6
|
attr_accessor(:id, # Integer
|
5
7
|
:severity, # String
|
@@ -29,6 +31,19 @@ module Trac
|
|
29
31
|
end
|
30
32
|
return true
|
31
33
|
end
|
34
|
+
|
35
|
+
# If a method call has no args and matches an instance variable,
|
36
|
+
# we return its value. e.g. if our tickets have a custom field
|
37
|
+
# called +work_units+, then +some_ticket.work_units+ will
|
38
|
+
# retrieve that value. This currently only allows retrieval and
|
39
|
+
# not updating the value.
|
40
|
+
def method_missing(sym,*args)
|
41
|
+
if args.size == 0 && instance_variables.include?("@" + sym.to_s)
|
42
|
+
instance_eval("@" + sym.to_s)
|
43
|
+
else
|
44
|
+
super.method_missing(sym,args)
|
45
|
+
end
|
46
|
+
end
|
32
47
|
|
33
48
|
# loads a ticket from the XMLRPC response
|
34
49
|
def self.load params
|