Sha256: f97700896c9ad49e5e101ae2a16d15c116db6fe203a23ca1bef1875120e64cb9

Contents?: true

Size: 1.04 KB

Versions: 17

Compression:

Stored size: 1.04 KB

Contents

module Spree
  module V2
    module Storefront
      class ProductSerializer < BaseSerializer
        set_type :product

        attributes :name, :description, :price, :currency, :display_price,
                   :available_on, :slug, :meta_description, :meta_keywords,
                   :updated_at

        attribute :purchasable,   &:purchasable?
        attribute :in_stock,      &:in_stock?
        attribute :backorderable, &:backorderable?
        attribute :available,     &:available?

        has_many :variants
        has_many :option_types
        has_many :product_properties
        has_many :taxons

        # all images from all variants
        has_many :images,
          object_method_name: :variant_images,
          id_method_name: :variant_image_ids,
          record_type: :image,
          serializer: :image

        has_one  :default_variant,
          object_method_name: :default_variant,
          id_method_name: :default_variant_id,
          record_type: :variant,
          serializer: :variant
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
spree_api-4.1.15 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.14 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.13.1 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.13 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.12 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.11 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.10 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.9 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.8 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.7 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.6 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.5 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.4 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.3 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.2 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.1 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.1.0 app/serializers/spree/v2/storefront/product_serializer.rb