Class: JIRA::Issue

Inherits:
DynamicEntity show all
Defined in:
lib/jiraSOAP/entities/issue.rb

Overview

TODO:

add attributes for the comments and the attachment metadata

Note:

Issues with an UNRESOLVED status will have nil for the value for #resolution_id.

Contains most of the data and metadata for a JIRA issue, but does not contain the Comments or AttachmentMetadata.

This class is easily the most convoluted structure in the API, and will 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.

Instance Attribute Summary collapse

Attributes inherited from DynamicEntity

#id

Instance Method Summary collapse

Methods inherited from Entity

add_attributes, #initialize_with_xml, new_with_xml, #to_soap

Instance Attribute Details

#affects_versionsArray<JIRA::Version>

Corresponds to affectsVersions in the javadoc.

Returns:

#assignee_usernameString

Corresponds to assignee in the javadoc.

Returns:

  • (String)

#attachment_namesArray<String>

Corresponds to attachmentNames in the javadoc.

Returns:

  • (Array<String>)

#componentsArray<JIRA::Version>

Corresponds to components in the javadoc.

Returns:

#create_timeTime

Corresponds to created in the javadoc.

Returns:

  • (Time)

#custom_field_valuesArray<JIRA::Version>

Corresponds to customFieldValues in the javadoc.

Returns:

#descriptionString

Corresponds to description in the javadoc.

Returns:

  • (String)

#due_dateTime

Corresponds to duedate in the javadoc.

This is actually a Time object with no time resolution.

Returns:

  • (Time)

#environmentString

Corresponds to environment in the javadoc.

Returns:

  • (String)

#fix_versionsArray<JIRA::Version>

Corresponds to fixVersions in the javadoc.

Returns:

#keyString

Corresponds to key in the javadoc.

Returns:

  • (String)

#last_updated_timeTime

Corresponds to updated in the javadoc.

Returns:

  • (Time)

#priority_idString

Corresponds to priority in the javadoc.

Returns:

  • (String)

#project_nameString

Corresponds to project in the javadoc.

Returns:

  • (String)

#reporter_usernameString

Corresponds to reporter in the javadoc.

Returns:

  • (String)

#resolution_idString

Corresponds to resolution in the javadoc.

Returns:

  • (String)

#status_idString

Corresponds to status in the javadoc.

Returns:

  • (String)

#summaryString

Corresponds to summary in the javadoc.

Returns:

  • (String)

#type_idString

Corresponds to type in the javadoc.

Returns:

  • (String)

#votesFixnum

Corresponds to votes in the javadoc.

Returns:

  • (Fixnum)

Instance Method Details

#soapify_for(msg) ⇒ Object

TODO:

see if we can use the simple and complex array builders

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:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/jiraSOAP/entities/issue.rb', line 58

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