Class: JIRA::Issue

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

Overview

Note:

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

Contains most of the data and metadata for a JIRA issue, but does not contain the Comment‘s 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

Instance Attribute Details

#affects_versions[JIRA::Version]

Returns:



68
69
70
# File 'lib/jiraSOAP/entities/issue.rb', line 68

def affects_versions
  @affects_versions
end

#assignee_usernameString

Returns:

  • (String)


56
57
58
# File 'lib/jiraSOAP/entities/issue.rb', line 56

def assignee_username
  @assignee_username
end

#attachment_names[String]

Returns:

  • ([String])


89
90
91
# File 'lib/jiraSOAP/entities/issue.rb', line 89

def attachment_names
  @attachment_names
end

#components[JIRA::Component]

Returns:



86
87
88
# File 'lib/jiraSOAP/entities/issue.rb', line 86

def components
  @components
end

#create_timeTime

Returns:

  • (Time)


71
72
73
# File 'lib/jiraSOAP/entities/issue.rb', line 71

def create_time
  @create_time
end

#custom_field_values[JIRA::CustomFieldValue]

Returns:



92
93
94
# File 'lib/jiraSOAP/entities/issue.rb', line 92

def custom_field_values
  @custom_field_values
end

#descriptionString

Returns:

  • (String)


41
42
43
# File 'lib/jiraSOAP/entities/issue.rb', line 41

def description
  @description
end

#due_dateTime

Returns this is actually a Time object with no time resolution.

Returns:

  • (Time)

    this is actually a Time object with no time resolution



74
75
76
# File 'lib/jiraSOAP/entities/issue.rb', line 74

def due_date
  @due_date
end

#environmentString

Returns:

  • (String)


83
84
85
# File 'lib/jiraSOAP/entities/issue.rb', line 83

def environment
  @environment
end

#fix_versions[JIRA::Version]

Returns:



77
78
79
# File 'lib/jiraSOAP/entities/issue.rb', line 77

def fix_versions
  @fix_versions
end

#keyString

Returns:

  • (String)


35
36
37
# File 'lib/jiraSOAP/entities/issue.rb', line 35

def key
  @key
end

#last_updated_timeTime

Returns:

  • (Time)


47
48
49
# File 'lib/jiraSOAP/entities/issue.rb', line 47

def last_updated_time
  @last_updated_time
end

#priority_idString

Returns:

  • (String)


62
63
64
# File 'lib/jiraSOAP/entities/issue.rb', line 62

def priority_id
  @priority_id
end

#project_nameString

Returns:

  • (String)


65
66
67
# File 'lib/jiraSOAP/entities/issue.rb', line 65

def project_name
  @project_name
end

#reporter_usernameString

Returns:

  • (String)


59
60
61
# File 'lib/jiraSOAP/entities/issue.rb', line 59

def reporter_username
  @reporter_username
end

#resolution_idString

Returns:

  • (String)


80
81
82
# File 'lib/jiraSOAP/entities/issue.rb', line 80

def resolution_id
  @resolution_id
end

#status_idString

Returns:

  • (String)


53
54
55
# File 'lib/jiraSOAP/entities/issue.rb', line 53

def status_id
  @status_id
end

#summaryString

Returns:

  • (String)


38
39
40
# File 'lib/jiraSOAP/entities/issue.rb', line 38

def summary
  @summary
end

#type_idString

Returns:

  • (String)


44
45
46
# File 'lib/jiraSOAP/entities/issue.rb', line 44

def type_id
  @type_id
end

#votesFixnum

Returns:

  • (Fixnum)


50
51
52
# File 'lib/jiraSOAP/entities/issue.rb', line 50

def votes
  @votes
end

Instance Method Details

#soapify_for(msg) ⇒ Object

TODO:

see if we can use the simple and complex array builders

TODO:

make this method shorter

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:



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'lib/jiraSOAP/entities/issue.rb', line 117

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