Module: RemoteAPI
- Included in:
- JIRA::JIRAService
- Defined in:
- lib/jiraSOAP/api.rb
Overview
logging
code refactoring and de-duplication
break the API down by task, like Apple’s developer documentation; I can break the tasks down by CRUD or by what they affect, or both
progressWorkflowAction and friends [target v0.7]
Contains the API defined by Atlassian for the [JIRA SOAP service](docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/soap/JiraSoapService.html).
There are several cases where this API diverges from the one defined by Atlassian; most notably, this API tries to be more idomatically Ruby by using snake case for method names.
Constant Summary collapse
- RESPONSE_XPATH =
XPath constant to get a node containing a response array. This could be used for all responses, but is only used in cases where we cannot use a more blunt XPath expression.
'/node()[1]/node()[1]/node()[1]/node()[2]'
Instance Method Summary collapse
-
#add_base64_encoded_attachments_to_issue_with_key(issue_key, filenames, data) ⇒ true
Expect this method to be slow.
- #add_comment_to_issue_with_key(issue_key, comment) ⇒ true
-
#add_version_to_project_with_key(project_key, version) ⇒ JIRA::Version
New versions cannot have the archived bit set and the release date field will ignore the time of day you give it and instead insert the time zone offset as the time of day.
-
#create_issue_with_issue(issue) ⇒ JIRA::Issue
Some fields will be ignored when an issue is created.
-
#create_project_role_with_role(project_role) ⇒ JIRA::ProjectRole
The role that was created.
-
#create_project_with_project(project) ⇒ JIRA::Project
Requires you to set at least a project name, key, and lead.
-
#create_user(username, password, full_name, email) ⇒ JIRA::User?
It seems that creating a user without any permission groups will trigger an exception on some versions of JIRA.
- #delete_project_avatar_with_id(avatar_id) ⇒ true
- #delete_project_role(project_role, confirm = true) ⇒ true
- #delete_project_with_key(project_key) ⇒ true
- #delete_user_with_name(username) ⇒ true
- #get_attachments_for_issue_with_key(issue_key) ⇒ [JIRA::Attachment]
- #get_comment_with_id(id) ⇒ JIRA::Comment
- #get_comments_for_issue_with_key(issue_key) ⇒ [JIRA::Comment]
- #get_custom_fields ⇒ [JIRA::Field]
-
#get_favourite_filters ⇒ [JIRA::Filter]
Retrieves favourite filters for the currently logged in user.
- #get_issue_count_for_filter_with_id(id) ⇒ Fixnum
- #get_issue_types ⇒ [JIRA::IssueType]
- #get_issue_types_for_project_with_id(project_id) ⇒ [JIRA::IssueType]
- #get_issue_with_id(issue_id) ⇒ JIRA::Issue
- #get_issue_with_key(issue_key) ⇒ JIRA::Issue
- #get_issues_from_filter_with_id(id, max_results = 500, offset = 0) ⇒ [JIRA::Issue]
-
#get_issues_from_jql_search(jql_query, max_results = 2000) ⇒ [JIRA::Issue]
This method is the equivalent of making an advanced search from the web interface.
- #get_notification_schemes ⇒ [JIRA::NotificationScheme]
- #get_priorities ⇒ [JIRA::Priority]
-
#get_project_avatar_for_key(project_key) ⇒ JIRA::Avatar
Gets you the default avatar image for a project; if you want all the avatars for a project, use #get_project_avatars_for_key.
-
#get_project_avatars_for_key(project_key, include_default_avatars = false) ⇒ [JIRA::Avatar]
Gets ALL avatars for a given project with this method; if you just want the project avatar, use #get_project_avatar_for_key.
-
#get_project_including_schemes_with_id(project_id) ⇒ JIRA::Project
Note: this method does not yet include the permission scheme.
- #get_project_role_with_id(role_id) ⇒ JIRA::ProjectRole
- #get_project_roles ⇒ [JIRA::ProjectRole]
- #get_project_with_id(project_id) ⇒ JIRA::Project
-
#get_project_with_key(project_key) ⇒ JIRA::Project
You need to explicitly ask for schemes in order to get them.
- #get_projects_without_schemes ⇒ [JIRA::Project]
- #get_resolution_date_for_issue_with_id(issue_id) ⇒ Time
- #get_resolution_date_for_issue_with_key(issue_key) ⇒ Time
- #get_resolutions ⇒ [JIRA::Resolution]
- #get_server_configuration ⇒ JIRA::ServerConfiguration
-
#get_server_info ⇒ JIRA::ServerInfo
The @build_date attribute is a Time value, but does not include a time.
- #get_statuses ⇒ [JIRA::Status]
- #get_subtask_issue_types ⇒ [JIRA::IssueType]
- #get_subtask_issue_types_for_project_with_id(project_id) ⇒ [JIRA::IssueType]
- #get_user_with_name(user_name) ⇒ JIRA::User
- #get_versions_for_project(project_key) ⇒ [JIRA::Version]
-
#login(user, password) ⇒ true
The first method to call; other methods will fail until you are logged in.
-
#logout ⇒ true, false
You only need to call this to make an explicit logout; normally, a session will automatically expire after a set time (configured on the server).
-
#project_role_name_unique?(project_role_name) ⇒ true, false
Returns true if the name does not exist.
-
#refresh_custom_fields ⇒ true
I have no idea what this method does.
-
#release_state_for_version_for_project(project_name, version) ⇒ true
You can set the release state for a project with this method.
-
#set_archive_state_for_version_for_project(project_key, version_name, state) ⇒ true
The archive state can only be set to true for versions that have not been released.
-
#set_new_project_avatar_for_project_with_key(project_key, mime_type, base64_image) ⇒ true
Use this method to create a new custom avatar for a project and set it to be current avatar for the project.
-
#set_project_avatar_for_project_with_key(project_key, avatar_id) ⇒ true
Change the project avatar to another existing avatar.
- #update_comment(comment) ⇒ JIRA::Comment
-
#update_issue(issue_key, *field_values) ⇒ JIRA::Issue
This method can update most, but not all, issue fields.
-
#update_project_role_with_role(project_role) ⇒ JIRA::ProjectRole
The role after the update.
-
#update_project_with_project(project) ⇒ JIRA::Project
The id of the project is the only field that you cannot update.
Instance Method Details
#add_base64_encoded_attachments_to_issue_with_key(issue_key, filenames, data) ⇒ true
optimize building the message, try a single pass
Expect this method to be slow.
535 536 537 538 539 540 541 542 543 544 545 546 547 |
# File 'lib/jiraSOAP/api.rb', line 535 def (issue_key, filenames, data) invoke('soap:addBase64EncodedAttachmentsToIssue') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_key msg.add 'soap:in2' do |submsg| filenames.each { |filename| submsg.add 'filenames', filename } end msg.add 'soap:in3' do |submsg| data.each { |datum| submsg.add 'base64EncodedData', datum } end } true end |
#add_comment_to_issue_with_key(issue_key, comment) ⇒ true
406 407 408 409 410 411 412 413 |
# File 'lib/jiraSOAP/api.rb', line 406 def add_comment_to_issue_with_key(issue_key, comment) invoke('soap:addComment') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_key msg.add 'soap:in2' do |submsg| comment.soapify_for submsg end } true end |
#add_version_to_project_with_key(project_key, version) ⇒ JIRA::Version
New versions cannot have the archived bit set and the release date field will ignore the time of day you give it and instead insert the time zone offset as the time of day.
Remember that the @release_date field is the tentative release date, so its value is independant of the @released flag.
Descriptions do not appear to be included with JIRA::Version objects that SOAP API provides.
286 287 288 289 290 291 292 293 |
# File 'lib/jiraSOAP/api.rb', line 286 def add_version_to_project_with_key(project_key, version) response = invoke('soap:addVersion') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key msg.add 'soap:in2' do |submsg| version.soapify_for submsg end } JIRA::Version.new_with_xml response.document.xpath('//addVersionReturn').first end |
#create_issue_with_issue(issue) ⇒ JIRA::Issue
Some fields will be ignored when an issue is created.
- reporter - you cannot override this value at creation
- resolution
-
- votes
- status
- due date - I think this is a bug in jiraSOAP or JIRA
- environment - I think this is a bug in jiraSOAP or JIRA
232 233 234 235 236 237 238 239 240 |
# File 'lib/jiraSOAP/api.rb', line 232 def create_issue_with_issue(issue) response = invoke('soap:createIssue') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1' do |submsg| issue.soapify_for submsg end } JIRA::Issue.new_with_xml response.document.xpath('//createIssueReturn').first end |
#create_project_role_with_role(project_role) ⇒ JIRA::ProjectRole
Returns the role that was created.
682 683 684 685 686 687 688 |
# File 'lib/jiraSOAP/api.rb', line 682 def create_project_role_with_role project_role response = invoke('soap:createProjectRole') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1' do |submsg| project_role.soapify_for submsg end } JIRA::ProjectRole.new_with_xml response.document.xpath('//createProjectRoleReturn').first end |
#create_project_with_project(project) ⇒ JIRA::Project
Requires you to set at least a project name, key, and lead. However, it is also a good idea to set other project properties, such as the permission scheme as the default permission scheme can be too restrictive in most cases.
317 318 319 320 321 322 323 |
# File 'lib/jiraSOAP/api.rb', line 317 def create_project_with_project(project) response = invoke('soap:createProjectFromObject') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1' do |submsg| project.soapify_for submsg end } JIRA::Project.new_with_xml response.document.xpath('//createProjectFromObjectReturn').first end |
#create_user(username, password, full_name, email) ⇒ JIRA::User?
It seems that creating a user without any permission groups will trigger an exception on some versions of JIRA. The irony is that this method provides no way to add groups. The good news though, is that the creation will still happen; but the user will have no permissions.
360 361 362 363 364 365 366 367 368 369 |
# File 'lib/jiraSOAP/api.rb', line 360 def create_user(username, password, full_name, email) response = invoke('soap:createUser') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', username msg.add 'soap:in2', password msg.add 'soap:in3', full_name msg.add 'soap:in4', email } JIRA::User.new_with_xml response.document.xpath('//createUserReturn').first end |
#delete_project_avatar_with_id(avatar_id) ⇒ true
add tests for this method
You cannot delete the system avatar
You need project administration permissions to delete an avatar
612 613 614 615 616 617 618 |
# File 'lib/jiraSOAP/api.rb', line 612 def delete_project_avatar_with_id avatar_id invoke('soap:deleteProjectAvatar') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', avatar_id } true end |
#delete_project_role(project_role, confirm = true) ⇒ true
the confirm argument appears to do nothing (at least on JIRA 4.0)
706 707 708 709 710 711 712 713 |
# File 'lib/jiraSOAP/api.rb', line 706 def delete_project_role project_role, confirm = true invoke('soap:deleteProjectRole') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1' do |submsg| project_role.soapify_for submsg end msg.add 'soap:in2', confirm } true end |
#delete_project_with_key(project_key) ⇒ true
599 600 601 602 603 604 605 |
# File 'lib/jiraSOAP/api.rb', line 599 def delete_project_with_key project_key invoke('soap:deleteProject') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key } true end |
#delete_user_with_name(username) ⇒ true
373 374 375 376 377 378 379 |
# File 'lib/jiraSOAP/api.rb', line 373 def delete_user_with_name(username) invoke('soap:deleteUser') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', username } true end |
#get_attachments_for_issue_with_key(issue_key) ⇒ [JIRA::Attachment]
264 265 266 267 268 269 270 271 272 |
# File 'lib/jiraSOAP/api.rb', line 264 def (issue_key) response = invoke('soap:getAttachmentsFromIssue') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_key } response.document.xpath("#{RESPONSE_XPATH}/getAttachmentsFromIssueReturn").map { |frag| JIRA::AttachmentMetadata.new_with_xml frag } end |
#get_comment_with_id(id) ⇒ JIRA::Comment
417 418 419 420 421 422 423 |
# File 'lib/jiraSOAP/api.rb', line 417 def get_comment_with_id(id) response = invoke('soap:getComment') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', id } JIRA::Comment.new_with_xml response.document.xpath('//getCommentReturn').first end |
#get_comments_for_issue_with_key(issue_key) ⇒ [JIRA::Comment]
427 428 429 430 431 432 433 434 435 |
# File 'lib/jiraSOAP/api.rb', line 427 def get_comments_for_issue_with_key(issue_key) response = invoke('soap:getComments') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_key } response.document.xpath("#{RESPONSE_XPATH}/getCommentsReturn").map { |frag| JIRA::Comment.new_with_xml frag } end |
#get_custom_fields ⇒ [JIRA::Field]
64 65 66 67 68 69 70 71 |
# File 'lib/jiraSOAP/api.rb', line 64 def get_custom_fields response = invoke('soap:getCustomFields') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getCustomFieldsReturn").map { |frag| JIRA::Field.new_with_xml frag } end |
#get_favourite_filters ⇒ [JIRA::Filter]
Retrieves favourite filters for the currently logged in user.
494 495 496 497 498 499 500 501 |
# File 'lib/jiraSOAP/api.rb', line 494 def get_favourite_filters response = invoke('soap:getFavouriteFilters') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getFavouriteFiltersReturn").map { |frag| JIRA::Filter.new_with_xml frag } end |
#get_issue_count_for_filter_with_id(id) ⇒ Fixnum
521 522 523 524 525 526 527 |
# File 'lib/jiraSOAP/api.rb', line 521 def get_issue_count_for_filter_with_id(id) response = invoke('soap:getIssueCountForFilter') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', id } response.document.xpath('//getIssueCountForFilterReturn').to_i end |
#get_issue_types ⇒ [JIRA::IssueType]
74 75 76 77 78 79 80 81 |
# File 'lib/jiraSOAP/api.rb', line 74 def get_issue_types response = invoke('soap:getIssueTypes') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getIssueTypesReturn").map { |frag| JIRA::IssueType.new_with_xml frag } end |
#get_issue_types_for_project_with_id(project_id) ⇒ [JIRA::IssueType]
439 440 441 442 443 444 445 446 447 |
# File 'lib/jiraSOAP/api.rb', line 439 def get_issue_types_for_project_with_id(project_id) response = invoke('soap:getIssueTypesForProject') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_id } response.document.xpath("#{RESPONSE_XPATH}/getIssueTypesForProjectReturn").map { |frag| JIRA::IssueType.new_with_xml frag } end |
#get_issue_with_id(issue_id) ⇒ JIRA::Issue
254 255 256 257 258 259 260 |
# File 'lib/jiraSOAP/api.rb', line 254 def get_issue_with_id(issue_id) response = invoke('soap:getIssueById') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_id } JIRA::Issue.new_with_xml response.document.xpath('//getIssueByIdReturn').first end |
#get_issue_with_key(issue_key) ⇒ JIRA::Issue
244 245 246 247 248 249 250 |
# File 'lib/jiraSOAP/api.rb', line 244 def get_issue_with_key(issue_key) response = invoke('soap:getIssue') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_key } JIRA::Issue.new_with_xml response.document.xpath('//getIssueReturn').first end |
#get_issues_from_filter_with_id(id, max_results = 500, offset = 0) ⇒ [JIRA::Issue]
507 508 509 510 511 512 513 514 515 516 517 |
# File 'lib/jiraSOAP/api.rb', line 507 def get_issues_from_filter_with_id(id, max_results = 500, offset = 0) response = invoke('soap:getIssuesFromFilterWithLimit') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', id msg.add 'soap:in2', offset msg.add 'soap:in3', max_results } response.document.xpath("#{RESPONSE_XPATH}/getIssuesFromFilterWithLimitReturn").map { |frag| JIRA::Issue.new_with_xml frag } end |
#get_issues_from_jql_search(jql_query, max_results = 2000) ⇒ [JIRA::Issue]
This method is the equivalent of making an advanced search from the web interface.
During my own testing, I found that HTTP requests could timeout for really large requests (~2500 results). So I set a more reasonable upper limit; feel free to override it, but be aware of the potential issues.
The JIRA::Issue structure does not include any comments or attachments.
178 179 180 181 182 183 184 185 186 187 |
# File 'lib/jiraSOAP/api.rb', line 178 def get_issues_from_jql_search(jql_query, max_results = 2000) response = invoke('soap:getIssuesFromJqlSearch') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', jql_query msg.add 'soap:in2', max_results } response.document.xpath("#{RESPONSE_XPATH}/getIssuesFromJqlSearchReturn").map { |frag| JIRA::Issue.new_with_xml frag } end |
#get_notification_schemes ⇒ [JIRA::NotificationScheme]
94 95 96 97 98 99 100 101 |
# File 'lib/jiraSOAP/api.rb', line 94 def get_notification_schemes response = invoke('soap:getNotificationSchemes') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getNotificationSchemesReturn").map { |frag| JIRA::NotificationScheme.new_with_xml frag } end |
#get_priorities ⇒ [JIRA::Priority]
44 45 46 47 48 49 50 51 |
# File 'lib/jiraSOAP/api.rb', line 44 def get_priorities response = invoke('soap:getPriorities') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getPrioritiesReturn").map { |frag| JIRA::Priority.new_with_xml frag } end |
#get_project_avatar_for_key(project_key) ⇒ JIRA::Avatar
Gets you the default avatar image for a project; if you want all the avatars for a project, use #get_project_avatars_for_key.
142 143 144 145 146 147 148 |
# File 'lib/jiraSOAP/api.rb', line 142 def get_project_avatar_for_key(project_key) response = invoke('soap:getProjectAvatar') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key } JIRA::Avatar.new_with_xml response.document.xpath('//getProjectAvatarReturn').first end |
#get_project_avatars_for_key(project_key, include_default_avatars = false) ⇒ [JIRA::Avatar]
Gets ALL avatars for a given project with this method; if you just want the project avatar, use #get_project_avatar_for_key.
155 156 157 158 159 160 161 162 163 164 |
# File 'lib/jiraSOAP/api.rb', line 155 def get_project_avatars_for_key(project_key, include_default_avatars = false) response = invoke('soap:getProjectAvatars') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key msg.add 'soap:in2', include_default_avatars } response.document.xpath("#{RESPONSE_XPATH}/getProjectAvatarsReturn").map { |frag| JIRA::Avatar.new_with_xml frag } end |
#get_project_including_schemes_with_id(project_id) ⇒ JIRA::Project
parse the permission scheme
Note: this method does not yet include the permission scheme.
395 396 397 398 399 400 401 |
# File 'lib/jiraSOAP/api.rb', line 395 def get_project_including_schemes_with_id(project_id) response = invoke('soap:getProjectWithSchemesById') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_id } JIRA::Project.new_with_xml response.document.xpath('//getProjectWithSchemesByIdReturn').first end |
#get_project_role_with_id(role_id) ⇒ JIRA::ProjectRole
672 673 674 675 676 677 678 |
# File 'lib/jiraSOAP/api.rb', line 672 def get_project_role_with_id role_id response = invoke('soap:getProjectRole') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', role_id } JIRA::ProjectRole.new_with_xml response.document.xpath('//getProjectRoleReturn').first end |
#get_project_roles ⇒ [JIRA::ProjectRole]
661 662 663 664 665 666 667 668 |
# File 'lib/jiraSOAP/api.rb', line 661 def get_project_roles response = invoke('soap:getProjectRoles') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getProjectRolesReturn").map { |frag| JIRA::ProjectRole.new_with_xml frag } end |
#get_project_with_id(project_id) ⇒ JIRA::Project
383 384 385 386 387 388 389 |
# File 'lib/jiraSOAP/api.rb', line 383 def get_project_with_id(project_id) response = invoke('soap:getProjectById') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_id } JIRA::Project.new_with_xml response.document.xpath('//getProjectByIdReturn').first end |
#get_project_with_key(project_key) ⇒ JIRA::Project
You need to explicitly ask for schemes in order to get them. By default, most project fetching methods purposely leave out all the scheme information as permission schemes can be very large.
120 121 122 123 124 125 126 |
# File 'lib/jiraSOAP/api.rb', line 120 def get_project_with_key(project_key) response = invoke('soap:getProjectByKey') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key } JIRA::Project.new_with_xml response.document.xpath('//getProjectByKeyReturn').first end |
#get_projects_without_schemes ⇒ [JIRA::Project]
This will not fill in JIRA::Scheme data for the projects.
568 569 570 571 572 573 574 575 |
# File 'lib/jiraSOAP/api.rb', line 568 def get_projects_without_schemes response = invoke('soap:getProjectsNoSchemes') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getProjectsNoSchemesReturn").map { |frag| JIRA::Project.new_with_xml frag } end |
#get_resolution_date_for_issue_with_id(issue_id) ⇒ Time
579 580 581 582 583 584 585 |
# File 'lib/jiraSOAP/api.rb', line 579 def get_resolution_date_for_issue_with_id issue_id response = invoke('soap:getResolutionDateById') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_id } response.document.xpath('//getResolutionDateByIdReturn').to_date end |
#get_resolution_date_for_issue_with_key(issue_key) ⇒ Time
589 590 591 592 593 594 595 |
# File 'lib/jiraSOAP/api.rb', line 589 def get_resolution_date_for_issue_with_key issue_key response = invoke('soap:getResolutionDateByKey') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_key } response.document.xpath('//getResolutionDateByKeyReturn').to_date end |
#get_resolutions ⇒ [JIRA::Resolution]
54 55 56 57 58 59 60 61 |
# File 'lib/jiraSOAP/api.rb', line 54 def get_resolutions response = invoke('soap:getResolutions') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getResolutionsReturn").map { |frag| JIRA::Resolution.new_with_xml frag } end |
#get_server_configuration ⇒ JIRA::ServerConfiguration
559 560 561 562 563 564 |
# File 'lib/jiraSOAP/api.rb', line 559 def get_server_configuration response = invoke('soap:getConfiguration') { |msg| msg.add 'soap:in0', @auth_token } JIRA::ServerConfiguration.new_with_xml response.document.xpath('//getConfigurationReturn').first end |
#get_server_info ⇒ JIRA::ServerInfo
The @build_date attribute is a Time value, but does not include a time.
551 552 553 554 555 556 |
# File 'lib/jiraSOAP/api.rb', line 551 def get_server_info response = invoke('soap:getServerInfo') { |msg| msg.add 'soap:in0', @auth_token } JIRA::ServerInfo.new_with_xml response.document.xpath('//getServerInfoReturn').first end |
#get_statuses ⇒ [JIRA::Status]
84 85 86 87 88 89 90 91 |
# File 'lib/jiraSOAP/api.rb', line 84 def get_statuses response = invoke('soap:getStatuses') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getStatusesReturn").map { |frag| JIRA::Status.new_with_xml frag } end |
#get_subtask_issue_types ⇒ [JIRA::IssueType]
461 462 463 464 465 466 467 468 |
# File 'lib/jiraSOAP/api.rb', line 461 def get_subtask_issue_types response = invoke('soap:getSubTaskIssueTypes') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath("#{RESPONSE_XPATH}/getSubTaskIssueTypesReturn").map { |frag| JIRA::IssueType.new_with_xml frag } end |
#get_subtask_issue_types_for_project_with_id(project_id) ⇒ [JIRA::IssueType]
472 473 474 475 476 477 478 479 480 |
# File 'lib/jiraSOAP/api.rb', line 472 def get_subtask_issue_types_for_project_with_id(project_id) response = invoke('soap:getSubTaskIssueTypesForProject') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_id } response.document.xpath("#{RESPONSE_XPATH}/getSubtaskIssueTypesForProjectReturn").map { |frag| JIRA::IssueType.new_with_xml frag } end |
#get_user_with_name(user_name) ⇒ JIRA::User
130 131 132 133 134 135 136 |
# File 'lib/jiraSOAP/api.rb', line 130 def get_user_with_name(user_name) response = invoke('soap:getUser') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', user_name } JIRA::User.new_with_xml response.document.xpath('//getUserReturn').first end |
#get_versions_for_project(project_key) ⇒ [JIRA::Version]
105 106 107 108 109 110 111 112 113 |
# File 'lib/jiraSOAP/api.rb', line 105 def get_versions_for_project(project_key) response = invoke('soap:getVersions') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key } response.document.xpath("#{RESPONSE_XPATH}/getVersionsReturn").map { |frag| JIRA::Version.new_with_xml frag } end |
#login(user, password) ⇒ true
The first method to call; other methods will fail until you are logged in.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jiraSOAP/api.rb', line 22 def login(user, password) response = invoke('soap:login') { |msg| msg.add 'soap:in0', user msg.add 'soap:in1', password } # cache now that we know it is safe to do so @user = user @auth_token = response.document.xpath('//loginReturn').first.to_s true end |
#logout ⇒ true, false
You only need to call this to make an explicit logout; normally, a session will automatically expire after a set time (configured on the server).
36 37 38 39 40 41 |
# File 'lib/jiraSOAP/api.rb', line 36 def logout response = invoke('soap:logout') { |msg| msg.add 'soap:in0', @auth_token } response.document.xpath('//logoutReturn').to_boolean end |
#project_role_name_unique?(project_role_name) ⇒ true, false
JIRA 4.0 returns an exception if the name already exists
Returns true if the name does not exist.
694 695 696 697 698 699 700 |
# File 'lib/jiraSOAP/api.rb', line 694 def project_role_name_unique? project_role_name response = invoke('soap:isProjectRoleNameUnique') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_role_name } response.document.xpath('//isProjectRoleNameUniqueReturn').to_boolean end |
#refresh_custom_fields ⇒ true
find out what this method does
I have no idea what this method does.
485 486 487 488 489 490 |
# File 'lib/jiraSOAP/api.rb', line 485 def refresh_custom_fields invoke('soap:refreshCustomFields') { |msg| msg.add 'soap:in0', @auth_token } true end |
#release_state_for_version_for_project(project_name, version) ⇒ true
You can set the release state for a project with this method.
329 330 331 332 333 334 335 336 |
# File 'lib/jiraSOAP/api.rb', line 329 def release_state_for_version_for_project(project_name, version) invoke('soap:releaseVersion') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_name msg.add 'soap:in2' do |submsg| version.soapify_for submsg end } true end |
#set_archive_state_for_version_for_project(project_key, version_name, state) ⇒ true
The archive state can only be set to true for versions that have not been released. However, this is not reflected by the return value of this method.
301 302 303 304 305 306 307 308 309 |
# File 'lib/jiraSOAP/api.rb', line 301 def set_archive_state_for_version_for_project(project_key, version_name, state) invoke('soap:archiveVersion') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key msg.add 'soap:in2', version_name msg.add 'soap:in3', state } true end |
#set_new_project_avatar_for_project_with_key(project_key, mime_type, base64_image) ⇒ true
You need project administration permissions to edit an avatar
Use this method to create a new custom avatar for a project and set it to be current avatar for the project.
The image, provided as base64 encoded data, should be a 48x48 pixel square. If the image is larger, the top left 48 pixels are taken, if it is smaller then it will be upscaled to 48 pixels. The small version of the avatar image (16 pixels) is generated automatically. If you want to switch a project avatar to an avatar that already exists on the system then use #set_project_avatar_for_project_with_key instead.
650 651 652 653 654 655 656 657 658 |
# File 'lib/jiraSOAP/api.rb', line 650 def set_new_project_avatar_for_project_with_key project_key, mime_type, base64_image invoke('soap:setNewProjectAvatar') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key msg.add 'soap:in2', mime_type msg.add 'soap:in3', base64_image } true end |
#set_project_avatar_for_project_with_key(project_key, avatar_id) ⇒ true
You need project administration permissions to edit an avatar
JIRA does not care if the avatar_id is valid
Change the project avatar to another existing avatar. If you want to upload a new avatar and set it to be the new project avatar use #set_new_project_avatar instead.
626 627 628 629 630 631 632 633 |
# File 'lib/jiraSOAP/api.rb', line 626 def set_project_avatar_for_project_with_key project_key, avatar_id invoke('soap:setProjectAvatar') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', project_key msg.add 'soap:in2', avatar_id } true end |
#update_comment(comment) ⇒ JIRA::Comment
451 452 453 454 455 456 457 458 |
# File 'lib/jiraSOAP/api.rb', line 451 def update_comment(comment) response = invoke('soap:editComment') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1' do |submsg| comment.soapify_for submsg end } frag = response.document.xpath('//editCommentReturn').first JIRA::Comment.new_with_xml frag end |
#update_issue(issue_key, *field_values) ⇒ JIRA::Issue
This method can update most, but not all, issue fields. Some limitations are because of how the API is designed, and some are because I have not yet implemented the ability to update fields made of custom objects (things in the JIRA module).
Fields known to not update via this method:
- status - use {#progress_workflow_action}
- - use {#add_base64_encoded_attachments_to_issue_with_key}
Though JIRA::FieldValue objects have an id field, they do not expect to be given id values. You must use the name of the field you wish to update.
211 212 213 214 215 216 217 218 219 220 |
# File 'lib/jiraSOAP/api.rb', line 211 def update_issue(issue_key, *field_values) response = invoke('soap:updateIssue') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1', issue_key msg.add 'soap:in2' do |submsg| field_values.each { |fv| fv.soapify_for submsg } end } JIRA::Issue.new_with_xml response.document.xpath('//updateIssueReturn').first end |
#update_project_role_with_role(project_role) ⇒ JIRA::ProjectRole
JIRA 4.0 will not update project roles, it will instead throw an exception telling you that the project role already exists
Returns the role after the update.
719 720 721 722 723 724 725 |
# File 'lib/jiraSOAP/api.rb', line 719 def update_project_role_with_role project_role response = invoke('soap:updateProjectRole') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1' do |submsg| project_role.soapify_for submsg end } JIRA::ProjectRole.new_with_xml response.document.xpath('//updateProjectRoleReturn').first end |
#update_project_with_project(project) ⇒ JIRA::Project
The id of the project is the only field that you cannot update. Or, at least the only field I know that you cannot update.
342 343 344 345 346 347 348 |
# File 'lib/jiraSOAP/api.rb', line 342 def update_project_with_project(project) response = invoke('soap:updateProject') { |msg| msg.add 'soap:in0', @auth_token msg.add 'soap:in1' do |submsg| project.soapify_for submsg end } JIRA::Project.new_with_xml response.document.xpath('//updateProjectReturn').first end |