Class: JIRA::Issue
- Inherits:
-
Object
- Object
- JIRA::Issue
- Defined in:
- lib/jiraSOAP/remoteEntities.rb
Overview
Represents a JIRA issue; easily the most convoluted structure in the API. This structure and anything related directly to it will most likely be the greatest source of bugs.
The irony of the situation is that this structure is also the most critical to have in working order.
Issues with an UNRESOLVED status will have nil for the value of @resolution.
Instance Attribute Summary collapse
- #affects_versions ⇒ [JIRA::Version]
- #assignee_name ⇒ String
- #attachment_names ⇒ [String]
- #components ⇒ [JIRA::Component]
- #create_date ⇒ Time
- #custom_field_values ⇒ [JIRA::CustomField]
- #description ⇒ String
- #due_date ⇒ Time
- #environment ⇒ String
- #fix_versions ⇒ [JIRA::Version]
- #id ⇒ String
- #key ⇒ String
- #last_updated ⇒ Time
- #priority_id ⇒ String
- #project_name ⇒ String
- #reporter_name ⇒ String
- #resolution_id ⇒ String
- #status_id ⇒ String
- #summary ⇒ String
- #type_id ⇒ String
- #votes ⇒ Fixnum
Class Method Summary collapse
-
.issue_with_xml_fragment(frag) ⇒ JIRA::Issue?
Factory method that takes a fragment of a SOAP response.
Instance Method Summary collapse
-
#soapify_for(msg) ⇒ Object
Generate the SOAP message fragment for an issue.
Instance Attribute Details
#affects_versions ⇒ [JIRA::Version]
457 458 459 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 457 def affects_versions @affects_versions end |
#assignee_name ⇒ String
449 450 451 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 449 def assignee_name @assignee_name end |
#attachment_names ⇒ [String]
471 472 473 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 471 def @attachment_names end |
#components ⇒ [JIRA::Component]
469 470 471 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 469 def components @components end |
#create_date ⇒ Time
459 460 461 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 459 def create_date @create_date end |
#custom_field_values ⇒ [JIRA::CustomField]
473 474 475 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 473 def custom_field_values @custom_field_values end |
#description ⇒ String
439 440 441 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 439 def description @description end |
#due_date ⇒ Time
461 462 463 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 461 def due_date @due_date end |
#environment ⇒ String
467 468 469 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 467 def environment @environment end |
#fix_versions ⇒ [JIRA::Version]
463 464 465 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 463 def fix_versions @fix_versions end |
#id ⇒ String
433 434 435 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 433 def id @id end |
#key ⇒ String
435 436 437 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 435 def key @key end |
#last_updated ⇒ Time
443 444 445 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 443 def last_updated @last_updated end |
#priority_id ⇒ String
453 454 455 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 453 def priority_id @priority_id end |
#project_name ⇒ String
455 456 457 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 455 def project_name @project_name end |
#reporter_name ⇒ String
451 452 453 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 451 def reporter_name @reporter_name end |
#resolution_id ⇒ String
465 466 467 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 465 def resolution_id @resolution_id end |
#status_id ⇒ String
447 448 449 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 447 def status_id @status_id end |
#summary ⇒ String
437 438 439 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 437 def summary @summary end |
#type_id ⇒ String
441 442 443 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 441 def type_id @type_id end |
#votes ⇒ Fixnum
445 446 447 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 445 def votes @votes end |
Class Method Details
.issue_with_xml_fragment(frag) ⇒ JIRA::Issue?
Factory method that takes a fragment of a SOAP response.
478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 478 def self.issue_with_xml_fragment(frag) return if frag.nil? issue = Issue.new issue.affects_versions = frag.xpath('affectsVersions/*').map { |frag| Version.version_with_xml_fragment frag } issue.fix_versions = frag.xpath('fixVersions/*').map { |frag| Version.version_with_xml_fragment frag } issue.components = frag.xpath('components/*').map { |frag| Component.component_with_xml_fragment frag } issue.custom_field_values = frag.xpath('customFieldValues/*').map { |frag| CustomField.custom_field_with_xml_fragment frag } issue. = frag.xpath('attachmentNames/*').map { |name| name.to_s } issue.id = frag.xpath('id').to_s issue.key = frag.xpath('key').to_s issue.summary = frag.xpath('summary').to_s issue.description = frag.xpath('description').to_s issue.type_id = frag.xpath('type').to_s issue.votes = frag.xpath('votes').to_s.to_i issue.status_id = frag.xpath('status').to_s issue.assignee_name = frag.xpath('assignee').to_s issue.reporter_name = frag.xpath('reporter').to_s issue.priority_id = frag.xpath('priority').to_s issue.project_name = frag.xpath('project').to_s issue.resolution_id = frag.xpath('resolution').to_s issue.environment = frag.xpath('environment').to_s date = frag.xpath('updated').to_s issue.last_updated = Time.xmlschema date unless date.nil? date = frag.xpath('updated').to_s issue.create_date = Time.xmlschema date unless date.nil? date = frag.xpath('updated').to_s issue.due_date = Time.xmlschema date unless date.nil? issue end |
Instance Method Details
#soapify_for(msg) ⇒ Object
Generate the SOAP message fragment for an issue. Can you spot the oddities and inconsistencies? (hint: there are many).
We don’t bother including fields that are ignored. I tried to only ignore fields that will never be needed at creation time, but I may have messed up.
We don’t wrap the whole thing in ‘issue’ tags for JIRA::Issue#RemoteAPI#RemoteAPI#create_issue_with_issue calls; this is an inconsistency in the way jiraSOAP works and may need to be worked around for other RemoteAPI methods.
Servers only seem to accept issues if components/versions are just ids and do not contain the rest of the Component/Version structure.
To get the automatic assignee we pass ‘-1’ as the value for @assignee.
Passing an environment/due date field with a value of nil causes the server to complain about the formatting of the message.
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 |
# File 'lib/jiraSOAP/remoteEntities.rb', line 539 def soapify_for(msg) #might be going away, since it appears to have no effect at creation time msg.add 'reporter', @reporter_name unless @reporter.nil? msg.add 'priority', @priority_id msg.add 'type', @type_id msg.add 'project', @project_name msg.add 'summary', @summary msg.add 'description', @description msg.add 'components' do |submsg| (@components || []).each { |component| submsg.add 'components' do |component_msg| component_msg.add 'id', component.id end } end msg.add 'affectsVersions' do |submsg| (@affects_versions || []).each { |version| submsg.add 'affectsVersions' do |version_msg| version_msg.add 'id', version.id end } end msg.add 'fixVersions' do |submsg| (@fix_versions || []).each { |version| submsg.add 'fixVersions' do |version_msg| version_msg.add 'id', version.id end } end msg.add 'assignee', (@assignee_name || '-1') msg.add_complex_array 'customFieldValues', (@custom_field_values || []) msg.add 'environment', @environment unless @environment.nil? msg.add 'duedate', @due_date.xmlschema unless @due_date.nil? end |