lib/zuora/calls/amend.rb in zuora-ruby-0.4.0 vs lib/zuora/calls/amend.rb in zuora-ruby-0.5.0

- old
+ new

@@ -9,13 +9,15 @@ # @return [Callable] function of builder def xml_builder lambda do |builder| builder[:api].amend do builder[:api].requests do - build_object builder, :amendments, :obj - build_object builder, :amend_options, :api - build_object builder, :preview_options, :api + Array.wrap(amendments).each do |amendment| + build_object builder, :amendments, amendment, :obj + end + build_object builder, :amend_options, amend_options, :api + build_object builder, :preview_options, preview_options, :api end end end end @@ -53,11 +55,10 @@ # Helper to recursively build XML from nested objects. # @param [Nokogiri::XML::Builder] builder # @param [Symbol] property_name - name of a property on this object # @param [Symbol] child_ns - namespace of child node fields # @return nil - def build_object(builder, property_name, child_ns) - object = send property_name + def build_object(builder, property_name, object, child_ns) fail 'Objects must respond to each' unless object.respond_to?(:each) object_name = Zuora::Utils::Envelope.to_zuora_key property_name builder[:api].send(object_name) do build_nodes builder, object, child_ns end