Sha256: 0967583e9955306fbd2b4d43f7ebfc509154bda166bdbcebbcca30d2865e37c6

Contents?: true

Size: 845 Bytes

Versions: 10

Compression:

Stored size: 845 Bytes

Contents

module Shipit
  class TaskSerializer < ActiveModel::Serializer
    include ConditionalAttributes

    has_one :author
    has_one :revision, serializer: ShortCommitSerializer

    attributes :id, :url, :html_url, :output_url, :type, :status, :action, :description, :updated_at, :created_at

    def revision
      object.until_commit
    end

    def url
      api_stack_task_url(object.stack, object)
    end

    def html_url
      stack_task_url(object.stack, object)
    end

    def output_url
      api_stack_task_output_url(object.stack, object)
    end

    def type
      :task
    end

    def action
      object.definition.try!(:action)
    end

    def include_action?
      type == :task
    end

    def description
      object.definition.try!(:action)
    end

    def include_description?
      type == :task
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shipit-engine-0.8.9 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.8 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.7 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.6 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.5 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.4 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.3 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.2 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.1 app/serializers/shipit/task_serializer.rb
shipit-engine-0.8.0 app/serializers/shipit/task_serializer.rb