Sha256: c4619ca96d0b28ef3591a09a682400dabc29689bf8e25a2881875a805dc838a5

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

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, :pull_requests_url,
               :deploy_spec, :undeployed_commits_count, :is_locked, :lock_reason, :continuous_deployment, :created_at,
               :updated_at, :locked_since, :last_deployed_at

    def url
      api_stack_url(object)
    end

    def html_url
      stack_url(object)
    end

    def tasks_url
      api_stack_tasks_url(object)
    end

    def pull_requests_url
      api_stack_pull_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 deploy_spec
      object.cached_deploy_spec.cacheable.config
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shipit-engine-0.18.1 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.18.0 app/serializers/shipit/stack_serializer.rb
shipit-engine-0.17.0 app/serializers/shipit/stack_serializer.rb