Class: IssueLinkType

Inherits:
Services show all
Defined in:
lib/jirarest2/services/issuelinktype.rb

Overview

An IssueLinkType Object represents one or all IssueLinkTypes

Instance Method Summary collapse

Methods inherited from Services

#delete, #get, #post, #put

Constructor Details

#initialize(connection, data = "") ⇒ Jirarest2::Result



46
47
48
49
50
51
52
53
54
# File 'lib/jirarest2/services/issuelinktype.rb', line 46

def initialize(connection,data = "")
  if data == "" then
    @uritail = "issueLinkType"
  else
    @uritail = "issueLinkType/#{data}"
  end
  super(connection)
  extract_fields(get) # Build the SingleIssueLinkType classes
end

Instance Method Details

#internal_name?(test) ⇒ Boolean

Is the name realy the internal name we need to use?



91
92
93
# File 'lib/jirarest2/services/issuelinktype.rb', line 91

def internal_name?(test)
  @types.has_key?(test)
end

#name(uiname) ⇒ Array?

Get the internal name and direction instead of the one in the UI.



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/jirarest2/services/issuelinktype.rb', line 76

def name(uiname)
  return uiname if @types.has_key?(uiname)  # If the name is already correct just bounce it back
  @types.each { |name,singletype|
    if singletype.inward == uiname then
      return singletype.name, "inward"
    elsif singletype.outward ==  uiname then
      return singletype.name, "outward"
    end
  }
  return nil # Nothing found don't want to return @all      
end

#valid_names(delimiter = ", ") ⇒ String

Return all valid issuetypefield entries that we now of



98
99
100
101
102
103
104
105
106
# File 'lib/jirarest2/services/issuelinktype.rb', line 98

def valid_names(delimiter = ", ")
  answer = Array.new
  @types.each { |name,singletype|
    answer << singletype.name
    answer << singletype.inward
    answer << singletype.outward
  }
  return answer.join(delimiter)
end