Sha256: 74f6da7cf7e8a04db5a9d67bcdba396b186419d519e68678c6e8074e6d6c41d1

Contents?: true

Size: 812 Bytes

Versions: 23

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

json.cache! [I18n.locale, variant] do
  json.(variant, *variant_attributes)
  json.display_price(variant.display_price.to_s)
  json.options_text(variant.options_text)
  json.track_inventory(variant.should_track_inventory?)
  json.in_stock(variant.in_stock?)
  json.is_backorderable(variant.is_backorderable?)

  # We can't represent Float::INFINITY in JSON
  # Under JSON this woulb be NULL
  # Under oj this would error
  json.total_on_hand(variant.should_track_inventory? ? variant.total_on_hand : nil)

  json.is_destroyed(variant.destroyed?)
  json.option_values(variant.option_values) do |option_value|
    json.(option_value, *option_value_attributes)
  end
  json.images(variant.gallery.images) do |image|
    json.partial!("spree/api/images/image", image: image)
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
solidus_api-2.8.6 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.8.5 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.8.4 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.8.3 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.8.2 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.8.1 app/views/spree/api/variants/_small.json.jbuilder
solidus_api-2.8.0 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.14 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.13 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.12 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.11 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.10 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.9 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.8 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.7 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.6 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.5 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.4 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.3 app/views/spree/api/variants/_small.json.jbuilder
solidus_api_devise_token_auth-2.8.0.alpha.2 app/views/spree/api/variants/_small.json.jbuilder