Sha256: 2b9dcfc5f189dc8bd3f117667e4c49402f5f054518d8dce047b5f739c3b97639

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true
module Shipit
  class StackSerializer < ActiveModel::Serializer
    include ConditionalAttributes

    has_one :lock_author

    attributes :id, :repo_owner, :repo_name, :environment, :html_url, :url, :tasks_url, :deploy_url,
      :merge_requests_url, :deploy_spec, :undeployed_commits_count, :is_locked, :lock_reason, :continuous_deployment,
      :created_at, :updated_at, :locked_since, :last_deployed_at, :branch, :merge_queue_enabled, :is_archived,
      :archived_since

    def url
      api_stack_url(object)
    end

    def html_url
      stack_url(object)
    end

    def tasks_url
      api_stack_tasks_url(object)
    end

    def merge_requests_url
      api_stack_merge_requests_url(object)
    end

    def is_locked
      object.locked?
    end

    def include_lock_reason?
      object.locked?
    end

    def include_lock_author?
      object.locked?
    end

    def include_locked_since?
      object.locked?
    end

    def is_archived
      object.archived?
    end

    def deploy_spec
      object.cached_deploy_spec.cacheable.config
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
shipit-engine-0.35.1 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.35.0 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.34.0 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.33.0 app/serializers/shipit/stack_serializer.rb