Class: JIRA::FieldValue

Inherits:
Object
  • Object
show all
Defined in:
lib/jiraSOAP/entities/field_value.rb

Overview

This class is a bit of a hack; it is really just a key-value pair and only used with RemoteAPI#update_issue.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field_name = nil, values = nil) ⇒ FieldValue

Returns a new instance of FieldValue.

Parameters:

  • field_name (String) (defaults to: nil)
  • values (Array) (defaults to: nil)


20
21
22
23
24
25
# File 'lib/jiraSOAP/entities/field_value.rb', line 20

def initialize field_name = nil, values = nil
  @field_name = field_name
  if values
    @values = values.is_a?( ::Array ) ? values : [values]
  end
end

Instance Attribute Details

#field_nameString

The name for regular fields, and the id for custom fields

Returns:

  • (String)


10
11
12
# File 'lib/jiraSOAP/entities/field_value.rb', line 10

def field_name
  @field_name
end

#valuesArray<#to_s>

An array for the values, usually only has one object

Returns:



16
17
18
# File 'lib/jiraSOAP/entities/field_value.rb', line 16

def values
  @values
end

Instance Method Details

#soapify_for(message, label = 'fieldValue') ⇒ Handsoap::XmlMason::Element

TODO:

soapify properly for custom objects (JIRA module).

Parameters:

  • message (Handsoap::XmlMason::Node)

    the node to add the object to

  • label (String) (defaults to: 'fieldValue')

    name for the tags that wrap the message

Returns:

  • (Handsoap::XmlMason::Element)


33
34
35
36
37
38
# File 'lib/jiraSOAP/entities/field_value.rb', line 33

def soapify_for message, label = 'fieldValue'
  message.add label do |message|
    message.add 'id', @field_name
    message.add_simple_array 'values', @values unless @values.nil?
  end
end