lib/you_track/client/issue.rb in you_track-0.1.0 vs lib/you_track/client/issue.rb in you_track-0.2.0
- old
+ new
@@ -20,10 +20,29 @@
attr_accessor :permitted_group
# CREATE https://confluence.jetbrains.com/display/YTD6/Create+New+Issue
# UPDATE https://confluence.jetbrains.com/display/YTD6/Update+an+Issue
+
+ def comments
+ service.comments.load(service.get_issue_comments(self.identity).body)
+ end
+
+ def comment(comment)
+ service.apply_issue_command("id" => self.identity, "comment" => comment)
+ comments.detect { |c| c.text == comment }
+ end
+
+ def state
+ custom_fields.detect { |f| f[0] == 'State' }.last
+ end
+
+ def state=(new_state)
+ service.apply_issue_command("id" => self.identity, "command" => "State #{new_state}")
+ self.reload
+ end
+
def save
if new_record?
requires :project, :summary
merge_attributes(
@@ -34,9 +53,15 @@
"attachments" => self.attachments,
"permittedGroups" => self.permitted_group,
).body
)
else
- raise NotImplementedError
+ requires :identity
+ service.update_issue(
+ "id" => self.identity,
+ "summary" => self.summary,
+ "description" => self.description
+ )
+ self.reload
end
end
end