Class: IssueLink
- Defined in:
- lib/jirarest2/services/issuelink.rb
Overview
This class is responsible for the Linking of Issues
No real getter as of yet (I just didn't need it)
Instance Method Summary collapse
-
#initialize(connection) ⇒ IssueLink
constructor
A new instance of IssueLink.
-
#link(thisIssue, remoteIssue, type, comment = nil) ⇒ Boolean
does the linking ig you don’t want to bother with the exact result.
-
#link_issue(thisIssue, remoteIssue, type, comment = nil) ⇒ Jirarest2::Result
Links two issues Right now the visibility feature for comments is not supported.
-
#valid_issuelinktypes(delimiter = ", ") ⇒ Object
Show the possible answers for the issuelinktypes.
Methods inherited from Services
Constructor Details
#initialize(connection) ⇒ IssueLink
Returns a new instance of IssueLink.
28 29 30 31 32 |
# File 'lib/jirarest2/services/issuelink.rb', line 28 def initialize(connection) @uritail = "issueLink" super(connection) @linktype = IssueLinkType.new(@connection) end |
Instance Method Details
#link(thisIssue, remoteIssue, type, comment = nil) ⇒ Boolean
does the linking ig you don’t want to bother with the exact result
98 99 100 101 102 103 104 |
# File 'lib/jirarest2/services/issuelink.rb', line 98 def link(thisIssue,remoteIssue,type,comment = nil) if link_issue(thisIssue,remoteIssue,type,comment).code == "201" then return true else return false end end |
#link_issue(thisIssue, remoteIssue, type, comment = nil) ⇒ Jirarest2::Result
Links two issues Right now the visibility feature for comments is not supported
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/jirarest2/services/issuelink.rb', line 63 def link_issue(thisIssue,remoteIssue,type,comment = nil) inwardIssue = key(thisIssue) outwardIssue = key(remoteIssue) # lets see if we have the right name if ! @linktype.internal_name?(type) then # time to find the correct name and see if we have to exchange tickets realname = @linktype.name(type) if realname.nil? then raise Jirarest2::ValueNotAllowedException.new(type,valid_issuelinktypes), type else type = realname[0] if realname[1] == "inward" then # we have to change the issues as jira only knows one direction. temp = inwardIssue inwardIssue = outwardIssue outwardIssue = temp end end end # if ! linktype.internal_name? #create the hashes for JSON json = Hash.new json["type"] = { "name" => type } json["inwardIssue"] = { "key" => inwardIssue } json["outwardIssue"] = { "key" => outwardIssue } json["comment"] = { "body" => comment} if comment return post(json) end |
#valid_issuelinktypes(delimiter = ", ") ⇒ Object
Show the possible answers for the issuelinktypes
51 52 53 |
# File 'lib/jirarest2/services/issuelink.rb', line 51 def valid_issuelinktypes(delimiter = ", ") return @linktype.valid_names(delimiter) end |