Class: TrackerApi::Endpoints::Attachments

Inherits:
Object
  • Object
show all
Defined in:
lib/tracker_api/endpoints/attachments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Attachments

Returns a new instance of Attachments.



6
7
8
# File 'lib/tracker_api/endpoints/attachments.rb', line 6

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/tracker_api/endpoints/attachments.rb', line 4

def client
  @client
end

Instance Method Details

#create(comment, files) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/tracker_api/endpoints/attachments.rb', line 11

def create(comment, files)
  return [] if files.to_a.empty?
  #Check files before upload to make it all or none.
  FileUtility.check_files_exist(files)
  attachment = Endpoints::Attachment.new(client)
  files.map do | file |
    attachment.create(comment, file)
  end  
end