Fixing issue with service-style batches and requests with bodies
authorSérgio Gomes <sgomes@google.com>
Fri, 15 Aug 2014 08:49:59 +0000 (09:49 +0100)
committerSérgio Gomes <sgomes@google.com>
Fri, 15 Aug 2014 08:49:59 +0000 (09:49 +0100)
lib/google/api_client/service/batch.rb

index 7a25776a3c85641a9a2734920547e231403a8014..7ba406e6121da6c6188c514c1fb1a5270dda832c 100644 (file)
@@ -80,6 +80,13 @@ module Google
             :api_method => call.method,
             :parameters => call.parameters
           }
+          if call.respond_to? :body
+            if call.body.respond_to? :to_hash
+              base_call[:body_object] = call.body
+            else
+              base_call[:body] = call.body
+            end
+          end
           @base_batch.add(base_call) do |base_result|
             result = Google::APIClient::Service::BatchedCallResult.new(
                 call, base_result)