Sha256: eb456fb7c2931fcf228f753f73c27a17345ab41be60fb664ed84956e2b29918b

Contents?: true

Size: 520 Bytes

Versions: 7

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

require 'taleo/resource'

module Taleo
  class Attachment < Resource
    def id
      data.fetch('id')
    end

    def type
      data.fetch('attachmentType')
    end

    def content_type
      data.fetch('contentType')
    end

    def can_download?
      data.key?('downloadUrl')
    end

    def download
      unless can_download?
        raise Error.new("Attachment #{id} is not available for download")
      end

      client.download(data.fetch('downloadUrl'))
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
taleo-0.6.0 lib/taleo/attachment.rb
taleo-0.5.0 lib/taleo/attachment.rb
taleo-0.4.0 lib/taleo/attachment.rb
taleo-0.3.0 lib/taleo/attachment.rb
taleo-0.2.0 lib/taleo/attachment.rb
taleo-0.1.1 lib/taleo/attachment.rb
taleo-0.1.0 lib/taleo/attachment.rb