From 5f9deddd3767e6fa4abae1817fa722c47e71448e Mon Sep 17 00:00:00 2001 From: vikas k Date: Tue, 27 Apr 2021 16:32:28 +0530 Subject: [PATCH] Modified batch update of company --- lib/hubspot/company.rb | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/hubspot/company.rb b/lib/hubspot/company.rb index f1aa4887..5a30959d 100644 --- a/lib/hubspot/company.rb +++ b/lib/hubspot/company.rb @@ -133,21 +133,21 @@ def remove_contact(id, contact_id) true end - def batch_update(companies, opts = {}) - request = companies.map do |company| - # Use the specified options or update with the changes - changes = opts.empty? ? company.changes : opts - - unless changes.empty? - { - "objectId" => company.id, - "properties" => changes.map { |k, v| { "name" => k, "value" => v } } - } - end - end + def batch_update(request) + # request = companies.map do |company| + # # Use the specified options or update with the changes + # changes = opts.empty? ? company.changes : opts + + # unless changes.empty? + # { + # "objectId" => company.id, + # "properties" => changes.map { |k, v| { "name" => k, "value" => v } } + # } + # end + # end # Remove any objects without changes and return if there is nothing to update - request.compact! + request.compact return true if request.empty? Hubspot::Connection.post_json(