Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions lib/hubspot/company.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down