Sha256: ed9daa77684ce13e4c8112e8979c88d5dc3b00ba4b1eefb822dc1f882b4c75cc

Contents?: true

Size: 630 Bytes

Versions: 7

Compression:

Stored size: 630 Bytes

Contents

# frozen_string_literal: true

require 'taleo/resource'

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

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

    def employee_id
      data.fetch('activityEmployee')
    end

    def can_download?
      relationship_urls.key?('formDownloadUrl')
    end

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

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

    has_one :employee, Employee, through: 'activityEmployee'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

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