Sha256: 2c90db0fe36a593b0f7bbe35fa1f257243b24104e8b19d7c9f62f035f0b0db2c

Contents?: true

Size: 826 Bytes

Versions: 1

Compression:

Stored size: 826 Bytes

Contents

module Sprangular
  class SmallVariantSerializer < BaseSerializer
    attributes :id, :name, :sku, :price, :weight, :height, :width, :depth,
               :is_master, :slug, :description, :track_inventory,
               :display_price, :options_text, :total_on_hand, :product_id

    attributes :in_stock, :is_backorderable, :is_destroyed

    has_many :option_values, embed: :objects,
                             serializer: Sprangular::OptionValueSerializer

    has_many :images, embed: :objects,
                      serializer: Sprangular::ImageSerializer

    # rubocop:disable Style/PredicateName
    def in_stock
      object.in_stock?
    end

    def is_destroyed
      object.destroyed?
    end

    def is_backorderable
      object.is_backorderable?
    end
    # rubocop:enable Style/PredicateName
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sprangular-0.1.0 app/serializers/sprangular/small_variant_serializer.rb