Sha256: 384188760f28f7829a5afb3a6c4746e17753efa488f50e705dae0686ba26cb37

Contents?: true

Size: 954 Bytes

Versions: 6

Compression:

Stored size: 954 Bytes

Contents

class Api::ShipmentsController < Api::BaseController
  resource_controller_for_api
  actions :index, :show, :update, :create
  belongs_to :order

  private

    def collection_serialization_options
      { :include => {:shipping_method => {}, :address => {}, :inventory_units => {:include => :variant}},
      :except => [:shipping_method_id, :address_id] }
    end

    def object_serialization_options
      { :include =>  {
        :shipping_method => {},
        :address => {:include => [:country, :state]},
        :inventory_units => {
          :include => {
            :variant => {
              :include => {
                :product => {:only => [:name]}
                }
              }
            }
          }
        },
        :except => [:shipping_method_id, :address_id]
      }
    end

    def eager_load_associations
      [:shipping_method, {:shipping_charge => :order}, :address, {:inventory_units => [:variant]}]
    end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
spree-0.11.4 vendor/extensions/api/app/controllers/api/shipments_controller.rb
spree-0.11.3 vendor/extensions/api/app/controllers/api/shipments_controller.rb
spree-0.11.2 vendor/extensions/api/app/controllers/api/shipments_controller.rb
spree-0.11.1 vendor/extensions/api/app/controllers/api/shipments_controller.rb
spree_api-0.30.0.beta1 app/controllers/api/shipments_controller.rb
spree-0.11.0 vendor/extensions/api/app/controllers/api/shipments_controller.rb