Sha256: b7775db1446690355eecf109e54d40d9d990de8149b344984acfb6a93b966fc5

Contents?: true

Size: 805 Bytes

Versions: 9

Compression:

Stored size: 805 Bytes

Contents

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

        attributes :email, :first_name, :last_name, :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

9 entries across 9 versions & 3 rubygems

Version Path
spree_api-4.5.5 app/serializers/spree/v2/storefront/user_serializer.rb
spree_api-4.5.4 app/serializers/spree/v2/storefront/user_serializer.rb
spree_api-4.5.3 app/serializers/spree/v2/storefront/user_serializer.rb
atkhayar-dev-spree-api-0.0.1 app/serializers/spree/v2/storefront/user_serializer.rb
atkhayar-dev-spree-api-0.0.0 app/serializers/spree/v2/storefront/user_serializer.rb
atkhayar-spree-dev-api-0.0.0 app/serializers/spree/v2/storefront/user_serializer.rb
spree_api-4.5.2 app/serializers/spree/v2/storefront/user_serializer.rb
spree_api-4.5.1 app/serializers/spree/v2/storefront/user_serializer.rb
spree_api-4.5.0 app/serializers/spree/v2/storefront/user_serializer.rb