Class: Morale::Commands::Ticket

Inherits:
Object
  • Object
show all
Extended by:
Flow, IO
Defined in:
lib/morale/commands/ticket.rb

Class Method Summary collapse

Methods included from Flow

retryable

Methods included from IO

ask, ask_for_secret, ask_for_secret_on_windows, echo_off, echo_on, say

Class Method Details

.command(command) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/morale/commands/ticket.rb', line 13

def command(command)
  begin
    ask_for_project
    print Morale::Command.client.ticket(Morale::Account.project, command) unless Morale::Account.project.nil?
  rescue Morale::Client::Unauthorized
    say "Authentication failure"
    Morale::Commands::Authorization.
    retry if Morale::Authorization.retry_login?
  rescue Morale::Client::NotFound
    say "Communication failure"
  end
end

.listObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/morale/commands/ticket.rb', line 26

def list
  begin
    ask_for_project
    print Morale::Command.client.tickets({ :project_id => Morale::Account.project }) unless Morale::Account.project.nil?
  rescue Morale::Client::Unauthorized
    say "Authentication failure"
    Morale::Commands::Authorization.
    retry if Morale::Authorization.retry_login?
  rescue Morale::Client::NotFound
    say "Communication failure"
  end
end