Docs are misaligned with actual gem

I’ve spent a couple of hours debugging my code,

  • pasted the following from your docs (ruby wrapper) -

    Read a batch of associations

require 'hubspot-api-client'

api_client = Hubspot::Client.new(access_token: 'YOUR_ACCESS_TOKEN')

body = {inputs: [{"id":"37295"}]}
api_response = api_client.crm.associations.batch_api.read(from_object_type: "fromObjectType", to_object_type: "toObjectType", body: body)
puts api_response

i was getting an error saying that “body” was missing.

After precious time spent on your github repository,

I found out the issue

ERROR:
client.crm.associations.batch_api.read(from_object_type: "deals", to_object_type: "contacts", body: body)

WORKS:
deals_to_contact = {inputs: [{"from":{"id": deal.id },"to":{"id": hubspot_contact.id},"type":"deal_to_contact"}]}
client.crm.associations.batch_api.create(from_object_type: "deals", to_object_type: "contacts", batch_input_public_association: body)

that was pretty annoying since we were forced to upgrade from deprecating hapikey.

The overall structure of the API has a learning curve incredibly “high”

I needed to:

- create, update, delete a contact (create_or_update no more appear to exist)

- create a deal associated to a contact (2 requests vs 1)

- create a task associated to a deal (2 requests vs 1)

Hope my feedback will help others

had to

#removed useless code from above

ERROR:
client.crm.associations.batch_api.read(from_object_type: "deals", to_object_type: "contacts", body: body)

WORKS:
client.crm.associations.batch_api.create(from_object_type: "deals", to_object_type: "contacts", batch_input_public_association: body)