Class: Jira::Command::Attachments

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket) ⇒ Attachments

Returns a new instance of Attachments.



16
17
18
# File 'lib/jira/commands/attachments.rb', line 16

def initialize(ticket)
  self.ticket = ticket
end

Instance Attribute Details

#ticketObject

Returns the value of attribute ticket.



14
15
16
# File 'lib/jira/commands/attachments.rb', line 14

def ticket
  @ticket
end

Instance Method Details

#runObject



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

def run
  return if ticket.empty?
  return if .empty?
  return if ['fields'].nil?

  attachments=['fields']['attachment']
  if !attachments.nil? and attachments.count > 0
    attachments.each do |attachment|
      name=attachment['filename']
      url=attachment['content']

      puts "#{Jira::Format.user(name)} #{url}"
    end
  else
    puts "No attachments found for ticket #{ticket}."
  end
end