Class: JIRA::Issue
- Inherits:
-
DynamicEntity
- Object
- Entity
- DynamicEntity
- JIRA::Issue
- Defined in:
- lib/jiraSOAP/entities/issue.rb
Overview
Add attributes for the comments and the attachment metadata
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 Attachments.
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 Method Summary collapse
- #affects_versions ⇒ Array<JIRA::Version>
- #assignee_username ⇒ String
- #attachment_names ⇒ Array<String>
- #components ⇒ Array<JIRA::Component>
- #create_time ⇒ Time
-
#custom_field(id) ⇒ JIRA::CustomFieldValue?
Get the value of a custom field given the custom field id, returns nil if the issue does not have a value for that field.
- #custom_field_values ⇒ Array<JIRA::CustomFieldValue>
- #description ⇒ String
-
#due_date ⇒ Time
This is actually a Time object with no time resolution.
- #environment ⇒ String
- #fix_versions ⇒ Array<JIRA::Version>
- #key ⇒ String
- #last_updated_time ⇒ Time
- #priority_id ⇒ String
- #project_name ⇒ String
- #reporter_username ⇒ String
- #resolution_id ⇒ String
-
#soapify_for(msg) ⇒ Object
Generate the SOAP message fragment for an issue.
- #status_id ⇒ String
- #summary ⇒ String
- #type_id ⇒ String
- #votes ⇒ Number
Methods inherited from DynamicEntity
Methods inherited from Entity
add_attribute, inherited, #initialize_with_xml, new_with_xml
Instance Method Details
#affects_versions ⇒ Array<JIRA::Version>
63 |
# File 'lib/jiraSOAP/entities/issue.rb', line 63 add_attribute :affects_versions, 'affectsVersions', [:children_as_objects, JIRA::Version] |
#assignee_username ⇒ String
30 |
# File 'lib/jiraSOAP/entities/issue.rb', line 30 add_attribute :assignee_username, 'assignee', :content |
#attachment_names ⇒ Array<String>
75 |
# File 'lib/jiraSOAP/entities/issue.rb', line 75 add_attribute :attachment_names, 'attachmentNames', :contents_of_children |
#components ⇒ Array<JIRA::Component>
69 |
# File 'lib/jiraSOAP/entities/issue.rb', line 69 add_attribute :components, 'components', [:children_as_objects, JIRA::Component] |
#create_time ⇒ Time
54 |
# File 'lib/jiraSOAP/entities/issue.rb', line 54 add_attribute :create_time, 'created', :to_iso_date |
#custom_field(id) ⇒ JIRA::CustomFieldValue?
Get the value of a custom field given the custom field id, returns nil if the issue does not have a value for that field.
83 84 85 |
# File 'lib/jiraSOAP/entities/issue.rb', line 83 def custom_field id custom_field_values.find { |field_value| field_value.id == id } end |
#custom_field_values ⇒ Array<JIRA::CustomFieldValue>
72 |
# File 'lib/jiraSOAP/entities/issue.rb', line 72 add_attribute :custom_field_values, 'customFieldValues', [:children_as_objects, JIRA::CustomFieldValue] |
#description ⇒ String
21 |
# File 'lib/jiraSOAP/entities/issue.rb', line 21 add_attribute :description, 'description', :content |
#due_date ⇒ Time
This is actually a Time object with no time resolution.
60 |
# File 'lib/jiraSOAP/entities/issue.rb', line 60 add_attribute :due_date, 'duedate', :to_iso_date |
#environment ⇒ String
45 |
# File 'lib/jiraSOAP/entities/issue.rb', line 45 add_attribute :environment, 'environment', :content |
#fix_versions ⇒ Array<JIRA::Version>
66 |
# File 'lib/jiraSOAP/entities/issue.rb', line 66 add_attribute :fix_versions, 'fixVersions', [:children_as_objects, JIRA::Version] |
#key ⇒ String
15 |
# File 'lib/jiraSOAP/entities/issue.rb', line 15 add_attribute :key, 'key', :content |
#last_updated_time ⇒ Time
51 |
# File 'lib/jiraSOAP/entities/issue.rb', line 51 add_attribute :last_updated_time, 'updated', :to_iso_date |
#priority_id ⇒ String
36 |
# File 'lib/jiraSOAP/entities/issue.rb', line 36 add_attribute :priority_id, 'priority', :content |
#project_name ⇒ String
39 |
# File 'lib/jiraSOAP/entities/issue.rb', line 39 add_attribute :project_name, 'project', :content |
#reporter_username ⇒ String
33 |
# File 'lib/jiraSOAP/entities/issue.rb', line 33 add_attribute :reporter_username, 'reporter', :content |
#resolution_id ⇒ String
42 |
# File 'lib/jiraSOAP/entities/issue.rb', line 42 add_attribute :resolution_id, 'resolution', :content |
#soapify_for(msg) ⇒ Object
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.
112 113 114 115 116 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 |
# File 'lib/jiraSOAP/entities/issue.rb', line 112 def soapify_for msg 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 'reporter', @reporter_username unless @reporter_username.nil? msg.add 'assignee', (@assignee_username || '-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 |
#status_id ⇒ String
27 |
# File 'lib/jiraSOAP/entities/issue.rb', line 27 add_attribute :status_id, 'status', :content |
#summary ⇒ String
18 |
# File 'lib/jiraSOAP/entities/issue.rb', line 18 add_attribute :summary, 'summary', :content |
#type_id ⇒ String
24 |
# File 'lib/jiraSOAP/entities/issue.rb', line 24 add_attribute :type_id, 'type', :content |
#votes ⇒ Number
48 |
# File 'lib/jiraSOAP/entities/issue.rb', line 48 add_attribute :votes, 'votes', :to_i |