Sha256: 366f22f591b4edcaa4a829d5f344b0704e2f3b9fba6dea58beab6342cb8d0d07

Contents?: true

Size: 658 Bytes

Versions: 7

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

require 'taleo/resource'
require 'taleo/attachment'

module Taleo
  # Stub Employee class
  class Employee < Resource; end

  class Candidate < Resource
    def id
      data.fetch('candId')
    end

    def employee_id
      data.fetch('employee')
    end

    def has_resume?
      relationship_urls.key?('resume')
    end

    def resume
      unless has_resume?
        raise Error.new("Candidate #{id} has no resume available for download")
      end

      client.download(relationship_urls.fetch('resume'))
    end

    has_one :employee, Employee
    has_many :attachments, Attachment, singular: 'attachment'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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