Class: Comment
Overview
Work with all the comments that an issue might have
Instance Method Summary collapse
-
#add(text) ⇒ Result
Add a comment to an issue.
-
#get(data = "") ⇒ Nil, Array(CommentElement)
Get a certain comment.
-
#initialize(connection, issueid, commentid = nil) ⇒ Comment
constructor
Set our uritail.
-
#update(text) ⇒ CommentElement
Update an comment.
Methods inherited from Services
Constructor Details
#initialize(connection, issueid, commentid = nil) ⇒ Comment
Set our uritail
63 64 65 66 67 68 69 70 |
# File 'lib/jirarest2/services/comment.rb', line 63 def initialize(connection, issueid, commentid = nil) if commentid then @uritail = "issue/#{issueid}/comment/#{commentid}" else @uritail = "issue/#{issueid}/comment" end super(connection) end |
Instance Method Details
#add(text) ⇒ Result
Add a comment to an issue
75 76 77 |
# File 'lib/jirarest2/services/comment.rb', line 75 def add(text) post({"body" => text}) end |
#get(data = "") ⇒ Nil, Array(CommentElement)
Get a certain comment
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/jirarest2/services/comment.rb', line 96 def get(data = "") result = super("") if result["comments"].nil? then return [create_element(result)] elsif result["comments"].empty? then return nil else resultarray = Array.new result["comments"].each { |singleresult| resultarray << create_element(singleresult) } return resultarray end end |
#update(text) ⇒ CommentElement
Update an comment
114 115 116 117 |
# File 'lib/jirarest2/services/comment.rb', line 114 def update(text) result = put({"body" => text}) return CommentElement.new(result["updateAuthor"]["displayName"], result["body"], result["created"], result["updated"]) end |