lib/hubspot/association.rb in hubspot-api-ruby-0.17.1 vs lib/hubspot/association.rb in hubspot-api-ruby-0.18.0

- old
+ new

@@ -73,9 +73,18 @@ response = Hubspot::Connection.get_json("/crm/v4/objects/#{object_type}/#{object_id}/associations/#{to_object_type}", {}) response['results'].map { |result| klass.find(result["toObjectId"]) } end + # Utility function to build the association list required by some API endpoints + def build_association_param(origin, associated, associated_id) + { + to: { id: associated_id }, + types: [{ associationCategory: 'HUBSPOT_DEFINED', + associationTypeId: Hubspot::Association::ASSOCIATION_DEFINITIONS[origin][associated] }] + } + end + private def build_create_association_body(association, definition_id) { from: {