Sha256: 93cf2fbb8a9d1c4a500cb3135e62150b313fdd4fd843702ce00e3a0367bfdf82

Contents?: true

Size: 857 Bytes

Versions: 4

Compression:

Stored size: 857 Bytes

Contents

module Spree
  module V2
    module Storefront
      class TaxonSerializer < BaseSerializer
        set_type   :taxon

        attributes :name, :pretty_name, :permalink, :seo_title, :meta_title, :meta_description,
                   :meta_keywords, :left, :right, :position, :depth, :updated_at

        attribute :is_root,  &:root?
        attribute :is_child, &:child?
        attribute :is_leaf,  &:leaf?

        belongs_to :parent,   record_type: :taxon, serializer: :taxon
        belongs_to :taxonomy, record_type: :taxonomy

        has_many   :children, record_type: :child, serializer: :taxon
        has_many   :products, record_type: :product

        has_one    :image,
          object_method_name: :icon,
          id_method_name: :icon_id,
          record_type: :taxon_image,
          serializer: :taxon_image
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_api-3.7.0 app/serializers/spree/v2/storefront/taxon_serializer.rb
spree_api-3.7.0.rc3 app/serializers/spree/v2/storefront/taxon_serializer.rb
spree_api-3.7.0.rc2 app/serializers/spree/v2/storefront/taxon_serializer.rb
spree_api-3.7.0.rc1 app/serializers/spree/v2/storefront/taxon_serializer.rb