Sha256: 188dc8aaef7a33cda95cdd74bb5c3b40e26c33c7c48e09254f5343074ef88deb
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
require 'morale/client' require 'morale/command' require 'morale/authorization' require 'hirb' module Morale::Commands class Ticket class << self include Morale::Platform def command(command) ticket = Morale::Command.client.ticket Morale::Account.project, command print ticket end private def print(ticket) due_date = Date.parse(ticket['due_date']).strftime("%b. %d") unless ticket['due_date'].nil? assigned_to = "#{ticket['assigned_to']['user']['first_name']} #{(ticket['assigned_to']['user']['last_name']).to_s[0,1]}." unless ticket['assigned_to'].nil? say Hirb::Helpers::Table.render [{ :id => ticket['identifier'], :type => ticket['type'], :title => ticket['title'], :created_by => "#{ticket['created_by']['user']['first_name']} #{(ticket['created_by']['user']['last_name']).to_s[0,1]}.", :due_date => due_date, :assigned_to => assigned_to, :priority => ticket['priority'] }], :fields => [:id, :type, :title, :created_by, :due_date, :assigned_to, :priority], :headers => { :created_by => "created by", :due_date => "due date", :assigned_to => "assigned to" } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
morale-0.1.1 | lib/morale/commands/ticket.rb |
morale-0.1.0 | lib/morale/commands/ticket.rb |