Sha256: 5eee8c668748adbb20908e09ab97f9ed564c57f2960a979fcd142c5bbfe94f2a

Contents?: true

Size: 780 Bytes

Versions: 4

Compression:

Stored size: 780 Bytes

Contents

module Spree
  module V2
    module Storefront
      class UserSerializer < BaseSerializer
        set_type :user

        attributes :email, :public_metadata

        attribute :store_credits do |user|
          user.total_available_store_credit
        end

        attribute :completed_orders do |object|
          object.orders.complete.count
        end

        has_one :default_billing_address,
          id_method_name: :bill_address_id,
          object_method_name: :bill_address,
          record_type: :address,
          serializer: :address

        has_one :default_shipping_address,
          id_method_name: :ship_address_id,
          object_method_name: :ship_address,
          record_type: :address,
          serializer: :address
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spree_api-4.4.1 app/serializers/spree/v2/storefront/user_serializer.rb
spree_api-4.4.0 app/serializers/spree/v2/storefront/user_serializer.rb
spree_api-4.4.0.rc2 app/serializers/spree/v2/storefront/user_serializer.rb
spree_api-4.4.0.rc1 app/serializers/spree/v2/storefront/user_serializer.rb