Sha256: ab9a067540d8c532047d1145b8b756043ee8175a3afa9e724456dcf3a1086ff4

Contents?: true

Size: 762 Bytes

Versions: 29

Compression:

Stored size: 762 Bytes

Contents

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

        cache_options store: nil

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

        attribute :final_price do |shipping_rate|
          shipping_rate.cost
        end

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

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

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

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
spree_api-4.10.1 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.10.0 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.9.0 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.8.3 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.8.2 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.7.3 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.6.6 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.5.5 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.4.1 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.5.4 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.6.5 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.7.2 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.7.1 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.6.4 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.7.0 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.6.3 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.6.2 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.6.1 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.6.0 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb
spree_api-4.5.3 app/serializers/spree/v2/storefront/estimated_shipping_rate_serializer.rb