class Git::Whistles::Youtrack::Ticket
Attributes
description[RW]
id[RW]
project[RW]
title[RW]
Public Class Methods
build_from_remote(ticket_hash)
click to toggle source
# File lib/git-whistles/youtrack/ticket.rb, line 5 def build_from_remote(ticket_hash) return nil if ticket_hash.nil? return nil if issue_not_found? ticket_hash self.new.tap do |ticket| ticket.title = title_from ticket_hash ticket.id = id_from ticket_hash ticket.project = project_from ticket_hash ticket.description = description_from ticket_hash end end
description_from(ticket_hash)
click to toggle source
# File lib/git-whistles/youtrack/ticket.rb, line 38 def description_from(ticket_hash) ticket_hash .dig('issue', 'field') .select { |f| f['name'] == 'description' } .first.dig('value') end
id_from(ticket_hash)
click to toggle source
# File lib/git-whistles/youtrack/ticket.rb, line 24 def id_from(ticket_hash) ticket_hash .dig('issue', 'field') .select { |f| f['name'] == 'numberInProject' } .first.dig('value').to_i end
issue_not_found?(ticket_hash)
click to toggle source
# File lib/git-whistles/youtrack/ticket.rb, line 45 def issue_not_found?(ticket_hash) if ticket_hash["error"] true else false end end
project_from(ticket_hash)
click to toggle source
# File lib/git-whistles/youtrack/ticket.rb, line 31 def project_from(ticket_hash) ticket_hash .dig('issue', 'field') .select { |f| f['name'] == 'projectShortName' } .first.dig('value') end
title_from(ticket_hash)
click to toggle source
# File lib/git-whistles/youtrack/ticket.rb, line 17 def title_from(ticket_hash) ticket_hash .dig('issue', 'field') .select { |f| f['name'] == 'summary' } .first.dig('value') end