Sha256: bd91789c08c0513d288dd0b4233b1b3591629650eb54ba4d60292f15261e548e

Contents?: true

Size: 963 Bytes

Versions: 13

Compression:

Stored size: 963 Bytes

Contents

module Shipit
  class TaskSerializer < ActiveModel::Serializer
    include ConditionalAttributes

    has_one :author
    has_one :revision, serializer: ShortCommitSerializer

    attributes(*%i(
      id
      url
      html_url
      output_url
      type
      status
      action
      title
      description
      started_at
      ended_at
      updated_at
      created_at
      env
      ignored_safeties
    ))

    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

13 entries across 13 versions & 1 rubygems

Version Path
shipit-engine-0.31.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.30.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.29.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.28.1 app/serializers/shipit/task_serializer.rb
shipit-engine-0.28.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.27.1 app/serializers/shipit/task_serializer.rb
shipit-engine-0.27.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.26.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.25.1 app/serializers/shipit/task_serializer.rb
shipit-engine-0.25.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.24.0 app/serializers/shipit/task_serializer.rb
shipit-engine-0.23.1 app/serializers/shipit/task_serializer.rb
shipit-engine-0.23.0 app/serializers/shipit/task_serializer.rb