Skip to content
This repository has been archived by the owner on Feb 23, 2020. It is now read-only.

Commit

Permalink
Add shipping_method code
Browse files Browse the repository at this point in the history
In 2-4-stable a code field was used for shipping methods. Here is the intention:

> The expectation, like a sku, is that a shipping_method.code could represent an immutable value that is safe to bind against when figuring
> out what shipping method to use.

Fixes #78
  • Loading branch information
deodad authored and Jeff Dutil committed May 18, 2015
1 parent 49dff00 commit 0250451
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/serializers/spree/wombat/shipment_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Wombat
class ShipmentSerializer < ActiveModel::Serializer
attributes :id, :order_id, :email, :cost, :status, :stock_location,
:shipping_method, :tracking, :placed_on, :shipped_at, :totals,
:updated_at, :channel, :items
:updated_at, :channel, :items, :shipping_method_code

has_one :bill_to, serializer: AddressSerializer, key: "billing_address"
has_one :ship_to, serializer: AddressSerializer, key: "shipping_address"
Expand Down Expand Up @@ -41,6 +41,10 @@ def stock_location
def shipping_method
object.shipping_method.try(:name)
end

def shipping_method_code
object.shipping_method.try(:code)
end

def placed_on
if object.order.completed_at?
Expand Down

0 comments on commit 0250451

Please sign in to comment.