Sha256: 42c62d37290dd9a76eb12fa806fd3bfbd1f23b7e37f7aa0fcc27ca0e4be00e17
Contents?: true
Size: 1.07 KB
Versions: 15
Compression:
Stored size: 1.07 KB
Contents
module Services module Hubspot module Associations class GetById def initialize(company_id) @company_id = company_id end def call return unless associated_contacts_id_object.present? contacts_list = ::Hubspot::Crm::Contacts::BatchApi.new.read_batch( body: associated_contacts_id_object, auth_names: 'oauth2' ).results end private def associated_contacts_id_object id_objects = ::Hubspot::Crm::Associations::BatchApi.new.read_batch( 'companies', 'contacts', body: company_id_object, auth_names: 'oauth2' ).results id_objects = id_objects.present? ? id_objects[0].to : [] ::Hubspot::Crm::Contacts::BatchReadInputSimplePublicObjectId.new(inputs: id_objects) end def company_id_object @company_id_object ||= ::Hubspot::Crm::Associations::BatchInputPublicObjectId.new( inputs: [@company_id] ) end end end end end
Version data entries
15 entries across 15 versions & 1 rubygems