jiraSOAP 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jiraSOAP/remoteAPI.rb +9 -3
- data/lib/jiraSOAP/remoteEntities.rb +31 -16
- data/lib/jiraSOAP/url.rb +7 -0
- metadata +3 -3
data/lib/jiraSOAP/remoteAPI.rb
CHANGED
@@ -148,11 +148,13 @@ module RemoteAPI
|
|
148
148
|
# Gets ALL avatars for a given project use this method; if you
|
149
149
|
# just want the default avatar, use {#get_project_avatar_for_key}.
|
150
150
|
# @param [String] project_key
|
151
|
+
# @param [boolean] include_default_avatars
|
151
152
|
# @return [[JIRA::Avatar]]
|
152
|
-
def get_project_avatars_for_key(project_key)
|
153
|
+
def get_project_avatars_for_key(project_key, include_default_avatars = false)
|
153
154
|
response = invoke('soap:getProjectAvatars') { |msg|
|
154
155
|
msg.add 'soap:in0', @auth_token
|
155
156
|
msg.add 'soap:in1', project_key
|
157
|
+
msg.add 'soap:in2', include_default_avatars
|
156
158
|
}
|
157
159
|
response.document.xpath("#{RESPONSE_XPATH}/getProjectAvatarsReturn").map {
|
158
160
|
|frag|
|
@@ -162,11 +164,15 @@ module RemoteAPI
|
|
162
164
|
|
163
165
|
# This method is the equivalent of making an advanced search from the
|
164
166
|
# web interface.
|
167
|
+
#
|
168
|
+
# During my own testing, I found that HTTP requests could timeout for really
|
169
|
+
# large requests (~2500 results). So I set a more reasonable upper limit;
|
170
|
+
# feel free to override it, but be aware of the potential issues.
|
165
171
|
# @param [String] jql_query JQL query as a string
|
166
172
|
# @param [Fixnum] max_results limit on number of returned results;
|
167
173
|
# the value may be overridden by the server if max_results is too large
|
168
174
|
# @return [[JIRA::Issue]]
|
169
|
-
def get_issues_from_jql_search(jql_query, max_results =
|
175
|
+
def get_issues_from_jql_search(jql_query, max_results = 2000)
|
170
176
|
response = invoke('soap:getIssuesFromJqlSearch') { |msg|
|
171
177
|
msg.add 'soap:in0', @auth_token
|
172
178
|
msg.add 'soap:in1', jql_query
|
@@ -243,7 +249,7 @@ module RemoteAPI
|
|
243
249
|
msg.add 'soap:in1', issue_key
|
244
250
|
}
|
245
251
|
frag = response.document.xpath '//getIssueReturn'
|
246
|
-
JIRA
|
252
|
+
JIRA::Issue.issue_with_xml_fragment frag
|
247
253
|
end
|
248
254
|
|
249
255
|
# @todo test this method
|
@@ -14,8 +14,9 @@ class Priority
|
|
14
14
|
priority.id = frag.xpath('id').to_s
|
15
15
|
priority.name = frag.xpath('name').to_s
|
16
16
|
priority.color = frag.xpath('color').to_s
|
17
|
-
priority.icon = URL.new frag.xpath('icon').to_s
|
18
17
|
priority.description = frag.xpath('description').to_s
|
18
|
+
url = frag.xpath('icon').to_s
|
19
|
+
priority.icon = URL.new url unless url.nil?
|
19
20
|
priority
|
20
21
|
end
|
21
22
|
end
|
@@ -32,8 +33,9 @@ class Resolution
|
|
32
33
|
resolution = Resolution.new
|
33
34
|
resolution.id = frag.xpath('id').to_s
|
34
35
|
resolution.name = frag.xpath('name').to_s
|
35
|
-
resolution.icon = URL.new frag.xpath('icon').to_s
|
36
36
|
resolution.description = frag.xpath('description').to_s
|
37
|
+
url = frag.xpath('icon').to_s
|
38
|
+
resolution.icon = url unless url.nil?
|
37
39
|
resolution
|
38
40
|
end
|
39
41
|
end
|
@@ -100,9 +102,10 @@ class IssueType
|
|
100
102
|
issue_type = IssueType.new
|
101
103
|
issue_type.id = frag.xpath('id').to_s
|
102
104
|
issue_type.name = frag.xpath('name').to_s
|
103
|
-
issue_type.icon = URL.new frag.xpath('icon').to_s
|
104
105
|
issue_type.subtask = frag.xpath('subtask').to_s == 'true'
|
105
106
|
issue_type.description = frag.xpath('description').to_s
|
107
|
+
url = frag.xpath('icon').to_s
|
108
|
+
issue_type.icon = URL.new url unless url.nil?
|
106
109
|
issue_type
|
107
110
|
end
|
108
111
|
end
|
@@ -121,11 +124,13 @@ class Comment
|
|
121
124
|
comment.id = frag.xpath('id').to_s
|
122
125
|
comment.original_author = frag.xpath('author').to_s
|
123
126
|
comment.body = frag.xpath('body').to_s
|
124
|
-
comment.create_date = Time.xmlschema frag.xpath('created').to_s
|
125
127
|
comment.group_level = frag.xpath('updateAuthor').to_s
|
126
128
|
comment.role_level = frag.xpath('roleLevel').to_s
|
127
129
|
comment.update_author = frag.xpath('updateAuthor').to_s
|
128
|
-
|
130
|
+
date = frag.xpath('created').to_s
|
131
|
+
comment.create_date = Time.xmlschema date unless date.nil?
|
132
|
+
date = frag.xpath('updated').to_s
|
133
|
+
comment.last_updated = Time.xmlschema date unless date.nil?
|
129
134
|
comment
|
130
135
|
end
|
131
136
|
|
@@ -155,8 +160,9 @@ class Status
|
|
155
160
|
status = Status.new
|
156
161
|
status.id = frag.xpath('id').to_s
|
157
162
|
status.name = frag.xpath('name').to_s
|
158
|
-
status.icon = URL.new frag.xpath('icon').to_s
|
159
163
|
status.description = frag.xpath('description').to_s
|
164
|
+
url = frag.xpath('icon').to_s
|
165
|
+
status.icon = URL.new url unless url.nil?
|
160
166
|
status
|
161
167
|
end
|
162
168
|
end
|
@@ -184,7 +190,8 @@ class Version
|
|
184
190
|
version.sequence = frag.xpath('sequence').to_s.to_i
|
185
191
|
version.released = frag.xpath('released').to_s == 'true'
|
186
192
|
version.archived = frag.xpath('archived').to_s == 'true'
|
187
|
-
|
193
|
+
date = frag.xpath('releaseDate').to_s
|
194
|
+
version.release_date = Time.xmlschema date unless date.nil?
|
188
195
|
version
|
189
196
|
end
|
190
197
|
|
@@ -260,8 +267,6 @@ class Project
|
|
260
267
|
project.id = frag.xpath('id').to_s
|
261
268
|
project.name = frag.xpath('name').to_s
|
262
269
|
project.key = frag.xpath('key').to_s
|
263
|
-
project.url = URL.new frag.xpath('url').to_s
|
264
|
-
project.project_url = URL.new frag.xpath('projectUrl').to_s
|
265
270
|
project.lead = frag.xpath('lead').to_s
|
266
271
|
project.description = frag.xpath('description').to_s
|
267
272
|
project.issue_security_scheme =
|
@@ -270,6 +275,10 @@ class Project
|
|
270
275
|
Scheme.scheme_with_xml_fragment frag.xpath 'notificationScheme'
|
271
276
|
project.permission_scheme =
|
272
277
|
PermissionScheme.scheme_with_xml_fragment frag.xpath 'permissionScheme'
|
278
|
+
url = frag.xpath('url').to_s
|
279
|
+
project.url = URL.new url unless url.nil?
|
280
|
+
url = frag.xpath('projectUrl').to_s
|
281
|
+
project.project_url = URL.new url unless url.nil?
|
273
282
|
project
|
274
283
|
end
|
275
284
|
|
@@ -352,17 +361,20 @@ class Issue
|
|
352
361
|
issue.summary = frag.xpath('summary').to_s
|
353
362
|
issue.description = frag.xpath('description').to_s
|
354
363
|
issue.type_id = frag.xpath('type').to_s
|
355
|
-
issue.last_updated = Time.xmlschema frag.xpath('updated').to_s
|
356
364
|
issue.votes = frag.xpath('votes').to_s.to_i
|
357
365
|
issue.status_id = frag.xpath('status').to_s
|
358
366
|
issue.assignee_name = frag.xpath('assignee').to_s
|
359
367
|
issue.reporter_name = frag.xpath('reporter').to_s
|
360
368
|
issue.priority_id = frag.xpath('priority').to_s
|
361
369
|
issue.project_name = frag.xpath('project').to_s
|
362
|
-
issue.create_date = Time.xmlschema frag.xpath('created').to_s
|
363
|
-
issue.due_date = Time.xmlschema frag.xpath('duedate').to_s
|
364
370
|
issue.resolution_id = frag.xpath('resolution').to_s
|
365
371
|
issue.environment = frag.xpath('environment').to_s
|
372
|
+
date = frag.xpath('updated').to_s
|
373
|
+
issue.last_updated = Time.xmlschema date unless date.nil?
|
374
|
+
date = frag.xpath('updated').to_s
|
375
|
+
issue.create_date = Time.xmlschema date unless date.nil?
|
376
|
+
date = frag.xpath('updated').to_s
|
377
|
+
issue.due_date = Time.xmlschema date unless date.nil?
|
366
378
|
issue
|
367
379
|
end
|
368
380
|
|
@@ -482,13 +494,14 @@ class AttachmentMetadata
|
|
482
494
|
# @return [JIRA::Attachment,nil]
|
483
495
|
def self.attachment_with_xml_fragment(frag)
|
484
496
|
return if frag.nil?
|
485
|
-
attachment =
|
497
|
+
attachment = AttachmentMetadata.new
|
486
498
|
attachment.id = frag.xpath('id').to_s
|
487
499
|
attachment.author = frag.xpath('author').to_s
|
488
|
-
attachment.create_date = Time.xmlschema frag.xpath('created').to_s
|
489
500
|
attachment.filename = frag.xpath('filename').to_s
|
490
501
|
attachment.file_size = frag.xpath('filesize').to_s.to_i
|
491
502
|
attachment.mime_type = frag.xpath('mimetype').to_s
|
503
|
+
date = frag.xpath('created').to_s
|
504
|
+
attachment.create_date = Time.xmlschema date unless date.nil?
|
492
505
|
attachment
|
493
506
|
end
|
494
507
|
end
|
@@ -504,13 +517,15 @@ class ServerInfo
|
|
504
517
|
def self.server_info_with_xml_fragment(frag)
|
505
518
|
return if frag.nil?
|
506
519
|
server_info = ServerInfo.new
|
507
|
-
server_info.base_url = URL.new frag.xpath('baseUrl').to_s
|
508
|
-
server_info.build_date = Time.xmlschema frag.xpath('buildDate').to_s
|
509
520
|
server_info.build_number = frag.xpath('buildNumber').to_s.to_i
|
510
521
|
server_info.edition = frag.xpath('edition').to_s
|
511
522
|
server_info.version = frag.xpath('version').to_s
|
523
|
+
date = frag.xpath('buildDate').to_s
|
524
|
+
server_info.build_date = Time.xmlschema date unless date.nil?
|
512
525
|
server_info.server_time =
|
513
526
|
TimeInfo.time_info_with_xml_fragment frag.xpath 'serverTime'
|
527
|
+
url = frag.xpath('baseUrl').to_s
|
528
|
+
server_info.base_url = URL.new url unless url.nil?
|
514
529
|
server_info
|
515
530
|
end
|
516
531
|
end
|
data/lib/jiraSOAP/url.rb
CHANGED
@@ -14,6 +14,13 @@ class URL
|
|
14
14
|
@url = URI.parse url
|
15
15
|
end
|
16
16
|
|
17
|
+
# The to_s method technically exists and so method_missing would not
|
18
|
+
# work its magic to redirect it to @url so we manually override.
|
19
|
+
# @return [String]
|
20
|
+
def to_s
|
21
|
+
@url.to_s
|
22
|
+
end
|
23
|
+
|
17
24
|
# The magic of the hack, passing everything to the level beneath.
|
18
25
|
def method_missing(method, *args)
|
19
26
|
@url.send method, *args
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 2
|
9
|
+
version: 0.2.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mark Rada
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-20 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|