class TicketAbstractorClient::Jira::Comment

Attributes

author_display_name[RW]
endpoint[RW]
project[RW]
ticket_id[RW]

Public Class Methods

fetch(ticket_id, endpoint) click to toggle source
# File lib/ticket_abstractor_client/jira/comment.rb, line 6
def self.fetch(ticket_id, endpoint)
  comments_list = Client.new(endpoint).get_comments(ticket_id: ticket_id)
  comments_list['comments'].map do |raw_comment|
    new(
      author: raw_comment['author']['name'],
      author_display_name: raw_comment['author']['displayName'],
      body: raw_comment['body'],
      external_created_at: raw_comment['created'],
      ticket_id: ticket_id,
      endpoint: endpoint
    )
  end
end
new(opts) click to toggle source
# File lib/ticket_abstractor_client/jira/comment.rb, line 20
def initialize(opts)
  super(opts)
  @author_display_name = opts[:author_display_name]
  @ticket_id, @endpoint, @project = opts.values_at(:ticket_id, :endpoint, :project)
end

Public Instance Methods

sync!() click to toggle source
# File lib/ticket_abstractor_client/jira/comment.rb, line 26
def sync!
  created_comment_hash = Client.new(@endpoint).create_comment(self)
  @author = created_comment_hash['author']['name']
  @author_display_name = created_comment_hash['author']['displayName']
  @external_created_at = created_comment_hash['created']
  self.set_data_hash!
end