Class: TicketSrv

Inherits:
Object
  • Object
show all
Defined in:
rtxmlsrv.rb

Constant Summary collapse

INTERFACE =
XMLRPC::interface("rt") {
  meth 'string add_watcher(struct)','Calls RT_Client::add_watcher'
  meth 'array attachments(struct)','Calls RT_Client::attachments'
  meth 'string comment(struct)','Calls RT_Client::comment'
  meth 'string correspond(struct)','Calls RT_Client::correspond'
  meth 'string create(struct)','Calls RT_Client::create'
  meth 'string create_user(struct)','Calls RT_Client::create_user'
  meth 'string edit(struct)','Calls RT_Client::edit'
  meth 'string edit_or_create_user(struct)','Calls RT_Client::edit_or_create_user'
  meth 'struct get_attachment(struct)','Calls RT_Client::get_attachment'
  meth 'struct history(struct)','Calls RT_Client::history (long form)'
  meth 'struct history_item(struct)','Calls RT_Client::history_item'
  meth 'array list(struct)','Calls RT_Client::list'
  meth 'array query(struct)','Calls RT_Client::query (long form)'
  meth 'struct show(struct)','Calls RT_Client::show'
}

Instance Method Summary collapse

Constructor Details

#initializeTicketSrv

Returns a new instance of TicketSrv.



32
33
# File 'rtxmlsrv.rb', line 32

def initialize
end

Instance Method Details

#add_watcher(struct) ⇒ Object

Allows watchers to be added via RT_Client::add_watcher You need to pass :id, :addr, and optionally :type



54
55
56
57
58
59
60
61
62
63
64
# File 'rtxmlsrv.rb', line 54

def add_watcher(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.add_watcher(struct)
  rt = nil
  val
end

#attachments(struct) ⇒ Object

Gets a list of attachments via RT_Client::attachments You need to pass :id, and optionally :unnamed



68
69
70
71
72
73
74
75
76
77
78
79
# File 'rtxmlsrv.rb', line 68

def attachments(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  rt = RT_Client.new
  val = rt.attachments(struct)
  rt = nil
  val
end

#comment(struct) ⇒ Object

Adds comments to tickets via RT_Client::comment



82
83
84
85
86
87
88
89
90
91
92
# File 'rtxmlsrv.rb', line 82

def comment(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.comment(struct)
  rt = nil
  val
end

#correspond(struct) ⇒ Object

Allows new tickets to be created via RT_Client::correspond



95
96
97
98
99
100
101
102
103
104
105
# File 'rtxmlsrv.rb', line 95

def correspond(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.correspond(struct)
  rt = nil
  val
end

#create(struct) ⇒ Object

Allows new tickets to be created via RT_Client::create



108
109
110
111
112
113
114
115
116
117
118
# File 'rtxmlsrv.rb', line 108

def create(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.create(struct)
  rt = nil
  val
end

#create_user(struct) ⇒ Object

Allows new users to be created via RT_Client::create_user



121
122
123
124
125
126
127
128
129
130
131
# File 'rtxmlsrv.rb', line 121

def create_user(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.create_user(struct)
  rt = nil
  val
end

#edit(struct) ⇒ Object

Allows existing ticket to be modified via RT_Client::edit



160
161
162
163
164
165
166
167
168
169
170
# File 'rtxmlsrv.rb', line 160

def edit(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.edit(struct)
  rt = nil
  val
end

#edit_or_create_user(struct) ⇒ Object

Allows new users to be edited or created if they don’t exist



147
148
149
150
151
152
153
154
155
156
157
# File 'rtxmlsrv.rb', line 147

def edit_or_create_user(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.edit_or_create_user(struct)
  rt = nil
  val
end

#get_attachment(struct) ⇒ Object

Retrieves attachments via RT_Client::get_attachment



173
174
175
176
177
178
179
180
181
182
183
# File 'rtxmlsrv.rb', line 173

def get_attachment(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.get_attachment(struct)
  rt = nil
  val
end

#history(struct) ⇒ Object

Gets the history of a ticket via RT_Client::history



186
187
188
189
190
191
192
193
194
195
196
# File 'rtxmlsrv.rb', line 186

def history(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.history(struct)
  rt = nil
  val
end

#history_item(struct) ⇒ Object

Gets a single history item via RT_Client::history_item



199
200
201
202
203
204
205
206
207
208
209
# File 'rtxmlsrv.rb', line 199

def history_item(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.history_item(struct)
  rt = nil
  val
end

#list(struct) ⇒ Object

Gets a list of tickets via RT_Client::list



212
213
214
215
216
217
218
219
220
221
222
# File 'rtxmlsrv.rb', line 212

def list(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.list(struct)
  rt = nil
  val
end

#query(struct) ⇒ Object

Gets a list of tickets via RT_Client::query



225
226
227
228
229
230
231
232
233
234
235
# File 'rtxmlsrv.rb', line 225

def query(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.query(struct)
  rt = nil
  val
end

#show(struct) ⇒ Object

Gets detail (minus history/attachments) via RT_Client::show



238
239
240
241
242
243
244
245
246
247
248
# File 'rtxmlsrv.rb', line 238

def show(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.show(struct)
  rt = nil
  val
end

#usersearch(struct) ⇒ Object

Find RT user details from email address via RT_Cleint::usersearch



134
135
136
137
138
139
140
141
142
143
144
# File 'rtxmlsrv.rb', line 134

def usersearch(struct)
  struct.remapkeys!
  if struct.has_key? :user and struct.has_key? :pass
    rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])
  else
    rt = RT_Client.new
  end
  val = rt.usersearch(struct)
  rt = nil
  val
end