Sha256: cfb24b7c5b177ee5173bac1e3ceacfc12649b69385ef2f6d0a96693fdfddb5ab

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 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, :ignore_ci

    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

5 entries across 5 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.38.0 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.37.0 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.36.1 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.36.0 app/serializers/shipit/stack_serializer.rb