lib/smartsend/parcel.rb in smartsend-ruby-0.1.1 vs lib/smartsend/parcel.rb in smartsend-ruby-0.2.0

- old
+ new

@@ -1,32 +1,33 @@ class Smartsend::Parcel - attr_accessor :id, :tracking_code, :tracking_url, :shipped_at, :reference, :weight, :height, :width, :length, :size, :freetext_lines, :items + attr_accessor :internal_id, :internal_reference, :weight, :height, :width, + :length, :freetext1, :freetext2, :freetext3, + :total_price_excluding_tax, :total_price_including_tax, + :total_tax_amount, :items def initialize(args={}) args.each do |k, v| instance_variable_set "@#{k}", v end @items ||= [] end def serialize - params = { - :shipdate => @shipped_at, - :reference => @reference, - :weight => @weight, - :height => @height, - :width => @width, - :length => @length, - :size => @size, - :items => @items.map(&:serialize) + { + :internal_id => internal_id, + :internal_reference => internal_reference, + :weight => weight, + :height => height, + :width => width, + :length => length, + :freetext1 => freetext1, + :freetext2 => freetext2, + :freetext3 => freetext3, + :total_price_excluding_tax => total_price_excluding_tax, + :total_price_including_tax => total_price_including_tax, + :total_tax_amount => total_tax_amount, + :items => items.map(&:serialize) } - - freetext_lines.to_a.each_with_index do |line, i| - params["freetext#{i.next}".to_sym] = line - end - - params - end end