Class: JIRA::Issue

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#affects_versions[JIRA::Version]

Returns:



457
458
459
# File 'lib/jiraSOAP/remoteEntities.rb', line 457

def affects_versions
  @affects_versions
end

#assignee_nameString

Returns:

  • (String)


449
450
451
# File 'lib/jiraSOAP/remoteEntities.rb', line 449

def assignee_name
  @assignee_name
end

#attachment_names[String]

Returns:

  • ([String])


471
472
473
# File 'lib/jiraSOAP/remoteEntities.rb', line 471

def attachment_names
  @attachment_names
end

#components[JIRA::Component]

Returns:



469
470
471
# File 'lib/jiraSOAP/remoteEntities.rb', line 469

def components
  @components
end

#create_dateTime

Returns:

  • (Time)


459
460
461
# File 'lib/jiraSOAP/remoteEntities.rb', line 459

def create_date
  @create_date
end

#custom_field_values[JIRA::CustomField]

Returns:



473
474
475
# File 'lib/jiraSOAP/remoteEntities.rb', line 473

def custom_field_values
  @custom_field_values
end

#descriptionString

Returns:

  • (String)


439
440
441
# File 'lib/jiraSOAP/remoteEntities.rb', line 439

def description
  @description
end

#due_dateTime

Returns:

  • (Time)


461
462
463
# File 'lib/jiraSOAP/remoteEntities.rb', line 461

def due_date
  @due_date
end

#environmentString

Returns:

  • (String)


467
468
469
# File 'lib/jiraSOAP/remoteEntities.rb', line 467

def environment
  @environment
end

#fix_versions[JIRA::Version]

Returns:



463
464
465
# File 'lib/jiraSOAP/remoteEntities.rb', line 463

def fix_versions
  @fix_versions
end

#idString

Returns:

  • (String)


433
434
435
# File 'lib/jiraSOAP/remoteEntities.rb', line 433

def id
  @id
end

#keyString

Returns:

  • (String)


435
436
437
# File 'lib/jiraSOAP/remoteEntities.rb', line 435

def key
  @key
end

#last_updatedTime

Returns:

  • (Time)


443
444
445
# File 'lib/jiraSOAP/remoteEntities.rb', line 443

def last_updated
  @last_updated
end

#priority_idString

Returns:

  • (String)


453
454
455
# File 'lib/jiraSOAP/remoteEntities.rb', line 453

def priority_id
  @priority_id
end

#project_nameString

Returns:

  • (String)


455
456
457
# File 'lib/jiraSOAP/remoteEntities.rb', line 455

def project_name
  @project_name
end

#reporter_nameString

Returns:

  • (String)


451
452
453
# File 'lib/jiraSOAP/remoteEntities.rb', line 451

def reporter_name
  @reporter_name
end

#resolution_idString

Returns:

  • (String)


465
466
467
# File 'lib/jiraSOAP/remoteEntities.rb', line 465

def resolution_id
  @resolution_id
end

#status_idString

Returns:

  • (String)


447
448
449
# File 'lib/jiraSOAP/remoteEntities.rb', line 447

def status_id
  @status_id
end

#summaryString

Returns:

  • (String)


437
438
439
# File 'lib/jiraSOAP/remoteEntities.rb', line 437

def summary
  @summary
end

#type_idString

Returns:

  • (String)


441
442
443
# File 'lib/jiraSOAP/remoteEntities.rb', line 441

def type_id
  @type_id
end

#votesFixnum

Returns:

  • (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.

Parameters:

  • frag (Handsoap::XmlQueryFront::NokogiriDriver)

Returns:



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.attachment_names    = 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.

Parameters:



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