lib/bill_hicks/order.rb in bill_hicks-1.1.4 vs lib/bill_hicks/order.rb in bill_hicks-1.1.5
- old
+ new
@@ -30,10 +30,14 @@
# * :zip [String] *required*
def add_header(header = {})
requires!(header, :customer, :purchase_order, :ffl, :shipping)
requires!(header[:shipping], :name, :address_1, :city, :state, :zip)
@header = header
+ # Ensure that address_2 is not an empty string
+ if @header[:shipping][:address_2] && @header[:shipping][:address_2].empty?
+ @header[:shipping][:address_2] = nil
+ end
end
# @option item [String] :item_number *required*
# @option item [Integer] :quantity *required*
# @option item [String] :price *required* - Decimal formatted price, without currency sign
@@ -84,10 +88,10 @@
'H',
@header[:customer],
@header[:shipping][:ship_to_number],
@header[:shipping][:name],
@header[:shipping][:address_1],
- (@header[:shipping][:address_2].empty? ? nil : @header[:shipping][:address_2]),
+ @header[:shipping][:address_2],
@header[:shipping][:city],
@header[:shipping][:state],
@header[:shipping][:zip],
@header[:purchase_order],
@header[:shipping_method],