class MineShipper::Redmine::Issue
Attributes
comments[R]
id[R]
identifier[R]
title[R]
tracker[R]
Public Class Methods
new(redmine, json)
click to toggle source
# File lib/mine-shipper/redmine.rb, line 27 def initialize(redmine, json) @redmine = redmine @json = json @tracker = "Redmine" @id = @json["id"] @identifier = "##{@json["id"]}" @title = @json["subject"] @comments = [] @json["journals"].each do |journal| next if journal["notes"].empty? @comments << Comment.new(journal) end end
Public Instance Methods
find_comment(comment)
click to toggle source
# File lib/mine-shipper/redmine.rb, line 57 def find_comment(comment) @comments.each do |my_comment| return my_comment if my_comment.corresponding?(comment) end nil end
post_comment(comment)
click to toggle source
# File lib/mine-shipper/redmine.rb, line 64 def post_comment(comment) path = "issues/#{id}.json" params = { issue: { notes: comment.render } } @redmine.api_request(path, params, :put) end
sync_comment(comment)
click to toggle source
# File lib/mine-shipper/redmine.rb, line 48 def sync_comment(comment) my_comment = find_comment(comment) if my_comment my_comment.update(comment) else post_comment(comment) end end
sync_comments(comments)
click to toggle source
# File lib/mine-shipper/redmine.rb, line 41 def sync_comments(comments) path = "issues/#{id}.json" comments.each do |comment| sync_comment(comment) end end