Class: JIRA::CustomField

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

Overview

TODO:

see if @key is always nil from the server

Represents a custom field with values.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idString

Returns:

  • (String)


82
83
84
# File 'lib/jiraSOAP/remoteEntities.rb', line 82

def id
  @id
end

#keyString

Returns:

  • (String)


84
85
86
# File 'lib/jiraSOAP/remoteEntities.rb', line 84

def key
  @key
end

#values[String]

Returns:

  • ([String])


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

def values
  @values
end

Class Method Details

.custom_field_with_xml_fragment(frag) ⇒ JIRA::CustomField?

Factory method that takes a fragment of a SOAP response.

Parameters:

  • frag (Handsoap::XmlQueryFront::NokogiriDriver)

Returns:



91
92
93
94
95
96
97
98
# File 'lib/jiraSOAP/remoteEntities.rb', line 91

def self.custom_field_with_xml_fragment(frag)
  return if frag.nil?
  custom_field        = CustomField.new
  custom_field.id     = frag.xpath('customfieldId').to_s
  custom_field.key    = frag.xpath('key').to_s
  custom_field.values = frag.xpath('values/*').map { |value| value.to_s }
  custom_field
end

Instance Method Details

#soapify_for(msg, label = 'customFieldValues') ⇒ Handsoap::XmlMason::Element

Generate a SOAP message fragment for the object.

Parameters:

  • msg (Handsoap::XmlMason::Node)

    SOAP message to add the object to

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

    tag name used in wrapping tags

Returns:

  • (Handsoap::XmlMason::Element)


104
105
106
107
108
109
110
# File 'lib/jiraSOAP/remoteEntities.rb', line 104

def soapify_for(msg, label = 'customFieldValues')
  msg.add label do |submsg|
    submsg.add 'customfieldId', @id
    submsg.add 'key', @key
    submsg.add_simple_array 'values', @values
  end
end