Sha256: 445ae0655f6299df6495e71abeb65a65981ec99d89c9e09a7eb217d8c4543219

Contents?: true

Size: 951 Bytes

Versions: 9

Compression:

Stored size: 951 Bytes

Contents

# frozen_string_literal: true
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, :title, :description, :started_at, :ended_at, :updated_at, :created_at, :env, :ignored_safeties, :max_retries, :retry_attempt)

    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&.action
    end

    def include_action?
      type == :task
    end

    def description
      object.definition&.action
    end

    def include_description?
      type == :task
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.38.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.37.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.36.1 app/serializers/shipit/task_serializer.rb
shipit-engine-0.36.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.35.1 app/serializers/shipit/task_serializer.rb
shipit-engine-0.35.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.34.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.33.0 app/serializers/shipit/task_serializer.rb