Module: Spree::V2::Storefront::TaxonSerializerDecorator

Defined in:
app/serializers/spree/v2/storefront/taxon_serializer_decorator.rb

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/serializers/spree/v2/storefront/taxon_serializer_decorator.rb', line 5

def self.prepended(base)
  base.has_many :vendors, serializer: ::Spree::V2::Storefront::VendorSerializer
  base.has_many :visible_products, serializer: ::Spree::V2::Storefront::ProductSerializer
  base.has_many :places, serializer: ::Spree::V2::Storefront::PlaceSerializer

  base.has_one :category_icon, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer
  base.has_one :app_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer
  base.has_one :web_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer
  base.has_one :home_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::AssetSerializer
  base.has_one :video_banner, serializer: ::SpreeCmCommissioner::V2::Storefront::VideoSerializer

  base.attributes :custom_redirect_url, :kind, :subtitle, :from_date, :to_date,
                  :background_color, :foreground_color, :show_badge_status,
                  :purchasable_on, :vendor_id, :available_on, :hide_video_banner

  base.attribute :purchasable_on_app do |taxon|
    taxon.purchasable_on == 'app' || taxon.purchasable_on == 'both'
  end

  base.attribute :purchasable_on_web do |taxon|
    taxon.purchasable_on == 'web' || taxon.purchasable_on == 'both'
  end

  base.attribute :participation_type_fields

  base.cache_options store: nil

  base.attribute :event_url, &:event_url
end