Module: Spree::V2::Storefront::LineItemSerializerDecorator

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

Class Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object

rubocop:disable Metrics/MethodLength



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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'app/serializers/spree/v2/storefront/line_item_serializer_decorator.rb', line 5

def self.prepended(base) # rubocop:disable Metrics/MethodLength
  base.attributes :from_date, :to_date, :need_confirmation, :product_type, :event_status, :amount, :display_amount,
                  :checkin_date, :checkout_date,
                  :number, :qr_data,
                  :kyc, :kyc_fields, :remaining_total_guests, :number_of_guests,
                  :completion_steps, :available_social_contact_platforms, :allow_anonymous_booking, :discontinue_on,
                  :high_demand, :jwt_token,
                  :direction, :trip_id, :boarding_trip_stop_id, :drop_off_trip_stop_id,
                  :service_fee_total, :display_service_fee_total,
                  :parent_id, :relation_type, :bundle_amount, :display_bundle_amount

  base.attribute :required_self_check_in_location, &:required_self_check_in_location?
  base.attribute :allowed_self_check_in, &:allowed_self_check_in?
  base.attribute :allowed_upload_later, &:allowed_upload_later?
  base.attribute :delivery_required, &:delivery_required?
  base.attribute :sufficient_stock, &:sufficient_stock?
  base.attribute :open_dated, &:open_dated?
  base.attribute :redeemed, &:redeemed?
  base.attribute :can_redeem, &:can_redeem?
  base.attribute :expired, &:expired?
  base.attribute :open_dated_route_label, &:open_dated_route_label

  base.attribute :pickup_map_place do |line_item|
    line_item.pickup_map_place&.to_h
  end

  base.attribute :dropoff_map_place do |line_item|
    line_item.dropoff_map_place&.to_h
  end

  base.attribute :distance do |line_item|
    line_item.distance&.to_h
  end

  base.has_one :vendor

  base.belongs_to :order, serializer: Spree::V2::Storefront::OrderSerializer

  base.has_one :google_wallet, serializer: SpreeCmCommissioner::V2::Storefront::GoogleWalletSerializer

  base.has_many :guests, serializer: SpreeCmCommissioner::V2::Storefront::GuestSerializer

  base.has_many :saved_guests, serializer: SpreeCmCommissioner::V2::Storefront::SavedGuestSerializer

  base.has_many :pending_guests, serializer: SpreeCmCommissioner::V2::Storefront::GuestSerializer

  base.has_one :product, serializer: Spree::V2::Storefront::ProductSerializer

  base.has_one :event, serializer: Spree::V2::Storefront::TaxonSerializer

  # completion_steps updates frequently
  base.cache_options store: nil
end