Class: Jira::Command::Tickets

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/commands/tickets.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username) ⇒ Tickets

Returns a new instance of Tickets.



17
18
19
# File 'lib/jira/commands/tickets.rb', line 17

def initialize(username)
  self.username = username
end

Instance Attribute Details

#usernameObject

Returns the value of attribute username.



15
16
17
# File 'lib/jira/commands/tickets.rb', line 15

def username
  @username
end

Instance Method Details

#runObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/jira/commands/tickets.rb', line 21

def run
  return if username.empty?
  return if .empty?

  issues = ['issues']
  if !issues.nil? and issues.count > 0
    issues.each do |issue|
      ticket = issue['key']

      printf "[%2d]", issues.index(issue)
      puts "  #{Jira::Format.ticket(ticket)}"
    end
  else
    puts "There are no tickets for username #{username}."
  end
end