Sha256: e246907ac02fa18866707ec5291a4e56aeb7e89d62a6c8b971930a863b6e3c48

Contents?: true

Size: 1.99 KB

Versions: 23

Compression:

Stored size: 1.99 KB

Contents

# frozen_string_literal: true

json.cache! [I18n.locale, shipment] do
  json.(shipment, *shipment_attributes)
  json.selected_shipping_rate do
    if shipment.selected_shipping_rate
      json.partial!("spree/api/shipping_rates/shipping_rate", shipping_rate: shipment.selected_shipping_rate)
    else
      json.nil!
    end
  end
  json.inventory_units(shipment.inventory_units) do |inventory_unit|
    json.(inventory_unit, *inventory_unit_attributes)
    json.variant do
      json.partial!("spree/api/variants/small", variant: inventory_unit.variant)
      json.(inventory_unit.variant, :product_id)
      json.images(inventory_unit.variant.gallery.images) do |image|
        json.partial!("spree/api/images/image", image: image)
      end
    end
    json.line_item do
      json.(inventory_unit.line_item, *line_item_attributes)
      json.single_display_amount(inventory_unit.line_item.single_display_amount.to_s)
      json.display_amount(inventory_unit.line_item.display_amount.to_s)
      json.total(inventory_unit.line_item.total)
    end
  end
  json.order do
    json.partial!("spree/api/orders/order", order: shipment.order)
    json.bill_address do
      if shipment.order.billing_address
        json.partial!("spree/api/addresses/address", address: shipment.order.billing_address)
      else
        json.nil!
      end
    end
    json.ship_address do
      json.partial!("spree/api/addresses/address", address: shipment.order.shipping_address)
    end
    json.adjustments(shipment.order.adjustments) do |adjustment|
      json.partial!("spree/api/adjustments/adjustment", adjustment: adjustment)
    end
    json.payments(shipment.order.payments) do |payment|
      json.(payment, :id, :amount, :display_amount, :state)
      if payment.source
        json.source do
          attrs = [:id]
          (attrs << :cc_type) if payment.source.respond_to?(:cc_type)
          json.(payment.source, *attrs)
        end
      end
      json.payment_method { json.(payment.payment_method, :id, :name) }
    end
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

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