Sha256: 2d2d461e7d054af503b24ae42451f351fe9191283c8b01e8e9cb693cebb17312

Contents?: true

Size: 1.02 KB

Versions: 10

Compression:

Stored size: 1.02 KB

Contents

module TrackerApi
  module Resources
    class FileAttachment
      include Shared::Base

      attribute :comment, Comment

      attribute :id, Integer
      attribute :big_url, String
      attribute :content_type, String
      attribute :created_at, DateTime
      attribute :download_url, String
      attribute :filename, String
      attribute :height, Integer
      attribute :kind, String
      attribute :size, Integer
      attribute :thumbnail_url, String
      attribute :thumbnailable, Boolean
      attribute :uploaded, Boolean
      attribute :uploader_id, Integer
      attribute :width, Integer

      def delete
        comment.delete_attachments([id])
      end

      # TODO : Implement download properly. 
      # Look at Attchment#download for more details
      # The big_url actually has the AWS S3 link for the file
      # def download
      #   file_data = Endpoints::Attachment.new(comment.client).download(download_url)
      #   File.open(filename, 'wb') { |fp| fp.write(file_data) }
      # end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tracker_api-1.16.0 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.15.0 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.14.0 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.13.0 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.12.0 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.11.0 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.10.0 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.9.1 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.9.0 lib/tracker_api/resources/file_attachment.rb
tracker_api-1.8.0 lib/tracker_api/resources/file_attachment.rb