Class: JIRA::FieldValue

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

Overview

A structure that is a bit of a hack; it is just a key-value pair that is used by 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)


13
14
15
16
# File 'lib/jiraSOAP/entities/field_value.rb', line 13

def initialize(field_name = nil, values = nil)
  @field_name = field_name
  @values     = values
end

Instance Attribute Details

#field_nameString

Returns the name for regular fields, and the id for custom fields.

Returns:

  • (String)

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



6
7
8
# File 'lib/jiraSOAP/entities/field_value.rb', line 6

def field_name
  @field_name
end

#valuesArray(#to_s)

Returns an array for the values, usually a single.

Returns:

  • (Array(#to_s))

    an array for the values, usually a single



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

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)


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

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