Sha256: 8e95b46b18740ab8ac0a856190c5a09011c4dd7b2154444a699227abcc45d8ef

Contents?: true

Size: 1013 Bytes

Versions: 37

Compression:

Stored size: 1013 Bytes

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?

        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

37 entries across 37 versions & 1 rubygems

Version Path
spree_api-4.0.1 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.7 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.0.0 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.0.0.rc3 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.6 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.5 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.0.0.rc2 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.0.0.rc1 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-4.0.0.beta app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.4 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.3 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.2 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.1 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.0 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.0.rc3 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.0.rc2 app/serializers/spree/v2/storefront/product_serializer.rb
spree_api-3.7.0.rc1 app/serializers/spree/v2/storefront/product_serializer.rb