Sha256: ee513fa81c88db2f8b312ffc61a450dc83cbaf4a96eb0dfe0e0469415d5c9532

Contents?: true

Size: 666 Bytes

Versions: 52

Compression:

Stored size: 666 Bytes

Contents

module Spree
  module V2
    module Storefront
      class EstimatedShippingRateSerializer < BaseSerializer
        set_type :shipping_rate

        attributes :name, :selected, :cost, :tax_amount, :shipping_method_id

        attribute :final_price, &:cost

        attributes :display_cost, :display_final_price do |object, params|
          Spree::Money.new(object.cost, currency: params[:currency])
        end

        attribute :display_tax_amount do |object, params|
          Spree::Money.new(object.tax_amount, currency: params[:currency])
        end

        attribute :free do |object|
          object.cost.zero?
        end
      end
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
spree_api-4.0.1 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-3.7.7 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.0.0 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.0.0.rc3 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-3.7.6 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-3.7.5 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.0.0.rc2 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.0.0.rc1 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.0.0.beta app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-3.7.4 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-3.7.3 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-3.7.2 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb